AnsweredAssumed Answered

Not able to insert in picomp table from Java

Question asked by PraveenCTS on Aug 6, 2015
Latest reply on Aug 6, 2015 by PraveenCTS

Hi All,


We are trying to connect to OsiPi Archive using JDBC. We are able to execute select query on picomp table.

Here is the code:

Connection con = null;

  String hostname = "myhostname";

  String dataSource = "mydatasource";

  String url = "jdbc:pisql://" + hostname + "/Data Source=" + dataSource + "; Integrated Security=SSPI;";


  String driver = "com.osisoft.jdbc.Driver";

  PreparedStatement stmt;

  ResultSet rs;

  Properties plist = new Properties();


  plist.put("user", "osiUser"); 

  plist.put("password", "osiPass");

  try {


   con = DriverManager.getConnection(url, plist);

   stmt = con.prepareStatement("SELECT tag, value FROM picomp WHERE tag like ?");

   stmt.setString(1, tagp);

   rs = stmt.executeQuery();

//extract results

   catch (SQLException  e) {



  catch (Exception  e) {




Now, when we try to insert into picomp table, we are getting following exception


java.sql.SQLException: [RDSA OLE DB Provider] IID_ICommand: Unspecified error (E_FAIL)

        at com.osisoft.jdbc.PreparedStatementImpl.executeUpdate(PreparedStatemen

        at getComp.main(

Caused by: com.osisoft.rdsa.RdsaException: [RDSA OLE DB Provider] IID_ICommand:

Unspecified error


        at com.osisoft.rdsa.Command.ExecuteNonQueryP(Native Method)

        at com.osisoft.rdsa.Command.executeNonQuery(

        at com.osisoft.jdbc.PreparedStatementImpl.executeUpdate(PreparedStatemen

        ... 1 more


Here is the code:


stmt = con.prepareStatement("insert into picomp (tag, value) values ('Test_Tag', 106)"); 

    Object c = ps.executeUpdate(); //line 44



Does anyone has any pointers as to why this exception is coming or what can we do about it.


Any pointers are appreciated.