Sat Aug 18, 2018 11:40 pm
Login Register Lost Password? Contact Us


HPCCPreparedStatement not accepting Long/Integer as params

Topics around the use of the JDBC driver for HPCC Systems

Tue Aug 02, 2016 3:46 pm Change Time Zone

Hi,

Trying to run the following example code...
Code: Select all
String myprepsql = "select k,s from ajp::temp::ds persons where k >= ? and k <= ?";
HPCCPreparedStatement prepstmt = (HPCCPreparedStatement)connection.prepareStatement(myprepsql);
prepstmt.setLong(1, (long)1);
prepstmt.setLong(2, (long)5);
HPCCResultSet qrs = (HPCCResultSet) ((HPCCPreparedStatement) prepstmt).executeQuery();
while(qrs.next()) {
   System.out.println(qrs.getInt("k"));
}


I get the following error message...
java.sql.SQLException: java.lang.Long cannot be cast to java.lang.String
at org.hpccsystems.jdbcdriver.HPCCPreparedStatement.executeQuery(HPCCPreparedStatement.java:108)


When looking at the HPCCPreparedStatement code it looks like any parameter passed in is type cast to a String. I'm wondering if this is something that could be changed in a future update?

Thanks,
Aaron
apohl
 
Posts: 2
Joined: Tue Aug 02, 2016 3:23 pm

Tue Aug 09, 2016 3:28 pm Change Time Zone

Aaron, I'm glad to see you got your project building.
Thanks for bringing up this issue, I'm currently working on the primitive type binding and will have a solution very soon. In the meantime you can add yourself as a watcher to this Jira so you can follow the progress. Thanks

https://track.hpccsystems.com/browse/JDBC-49

Update, just noticed you were the original reporter of the issue... the fix has been submitted and will the reviewed shortly. If you're in a hurry you can pull the commit from my repo: https://github.com/rpastrana/hpcc-jdbc/ ... ypeBinding
rodrigo.pastrana
 
Posts: 22
Joined: Tue Jun 10, 2014 2:19 pm


Return to Java Tools

Who is online

Users browsing this forum: No registered users and 1 guest

cron