Java Error - (java.sql.SQLException) java.sql.SQLException: [PIOLEDBENT]

Discussion created by kjelavankal on Sep 17, 2014
Latest reply on Oct 6, 2014 by michaelh

Hi , I am new to PI system . I am writing Java code to connect to PI and retrieve data.


The connection part is working fine however I am having issues with the SQL


public String connectToPI() {   
    Connection conn = null;
            PreparedStatement pstmt;
            ResultSet rs;
            String url = "jdbc:pi://XXXXX/Data Source=XXXXXXX; Integrated Security=SSPI";
            String driver = "com.osisoft.jdbc.Driver";
            Properties plist = new Properties();
            conn=DriverManager.getConnection(url, plist);
            pstmt = conn.prepareStatement("SELECT tag, time, value, status FROM piarchive..pisnapshot where pisnapshot.Tag LIKE '%XXXXX%'");
            //pstmt = conn.prepareStatement("SELECT tag, time, value, status FROM picomp where Tag LIKE '%XXXXX%'");
            //pstmt = conn.prepareStatement(" SELECT TAG from PIPOINT WHERE Tag LIKE '%XXXXX%' ");
            DatabaseMetaData md = conn.getMetaData();
            System.out.println(md.getDriverName() + " " + md.getDriverVersion());
     System.out.println(md.getDatabaseProductVersion() + "\n");
            while (rs.next()) {
   String value, tag;
   tag = rs.getString(1);
   value = rs.getString(1);
   System.out.println(tag+" "+value);




I am getting the following errors


(java.sql.SQLException) java.sql.SQLException: [PIOLEDBENT] Catalog name piarchive is invalid.


(java.sql.SQLException) java.sql.SQLException: [PIOLEDBENT] Table/View/Table View names PIPOINT is invalid




Please help