*Hi,

I have created a table in my ignite cluster (v2.1) using the following DDL
-*

CREATE TABLE test 
(
  id             LONG,
  name           VARCHAR,
  PRIMARY KEY (id)
  
)
WITH "backups=1,affinityKey=id";

*I am trying to query the table using IgniteJdbcThinDriver. The code to
query is as follows -*

String sql = "/select * from test where id = ?/";
List params = new ArrayList();
params.add(1L);
ResultSet rs = null;
Class.forName("org.apache.ignite.IgniteJdbcThinDriver");
Connection conn =
DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/");
PreparedStatement stmt = conn.prepareStatement(sql);
if (null != params) {
        int i = 1;
        for (Object param : params) {
        stmt.setObject(i, param);
        i++;
        }
}
rs = stmt.executeQuery();
conn.close();

*I am getting the following error -*

java.sql.SQLException: Failed to query Ignite.
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:123)
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinPreparedStatement.executeWithArguments(JdbcThinPreparedStatement.java:221)
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinPreparedStatement.executeQuery(JdbcThinPreparedStatement.java:68)
        at
com.walmart.ecommerce.fulfillment.node.commons.manager.dlr.work.Tester.main(Tester.java:34)
Caused by: class org.apache.ignite.IgniteCheckedException: Error server
response: [req=JdbcQueryExecuteRequest [schemaName=null, pageSize=1024,
maxRows=0, sqlQry=select * from test where id = ?, args=[1]],
resp=JdbcResponse [res=null, status=1, err=javax.cache.CacheException: class
org.apache.ignite.IgniteCheckedException: null]]
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinTcpIo.sendRequest(JdbcThinTcpIo.java:253)
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinTcpIo.queryExecute(JdbcThinTcpIo.java:227)
        at
org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:109)
        ... 3 more



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Reply via email to