AnsweredAssumed Answered

Encountered java.sql.SQLException: [RDSA OLE DB Provider] IID_ICommand: DB_E_PARAMNOTOPTIONAL error while query the PI server data via PI JDBC PreparedStatement

Question asked by hodneeri on Aug 22, 2016
Latest reply on Aug 23, 2016 by hodneeri

When using below java PreparedStatement to query PI server data via PI JDBC (refer below screenshot), its hit [RDSA OLE DB Provider] IID_ICommand: DB_E_PARAMNOTOPTIONAL error

 

     .......

     pStatement = connection.prepareStatement("SELECT tag,CAST(value AS Float64),__utctime FROM piarchive..piavg WHERE tag = ? AND time >= DATE(?) AND time < DATE(?) AND timestep = ?");    

    ......

    pStatement.setString(1, "sinusoid");

    pStatement.setString(2, "2016-08-18T04:57:01");

    pStatement.setString(3, "2016-08-22T04:57:02");

    pStatement.setString(4, "1h");

     ......

    resultSet = pStatement.executeQuery();

 

 

 

 

But if run with java Statement to query PI server data via PI JDBC, its work OK

 

    ......

   Statement statement = connection.createStatement();

   ResultSet resultSet = statement.executeQuery("SELECT tag,CAST(value AS Float64),__utctime FROM piarchive..piavg WHERE tag = 'SINUSOID' AND time >= DATE('2016-08-18T04:57:01') AND time < DATE('2016-08-22T04:57:01')  AND timestep = '1d'");

  ......

 

 

 

Please advice!

 

 

Outcomes