ksql-jdbc-driver icon indicating copy to clipboard operation
ksql-jdbc-driver copied to clipboard

Feature not supported: getType

Open JirHr opened this issue 3 years ago • 1 comments

Hello,

I am using Groovy, which has nice groovy.sql.Sql. I would like to use it with ksql and therefore I have installed your jdbc... This is my simple code: import groovy.sql.Sql

class GroSandbox02Main { static void main(String[] args) { java.sql.DriverManager.registerDriver(new com.github.mmolimar.ksql.jdbc.KsqlDriver()) Sql sqlKsql = Sql.newInstance('jdbc:ksql://localhost:8088') String selStreams=""" SELECT * FROM policy EMIT CHANGES""" sqlKsql.eachRow(selStreams) { GroovyResultSet rs -> println rs } sqlKsql.close() } }

resulting in: SELECT * FROM policy EMIT CHANGES because: Feature not supported: getType. Exception in thread "main" java.sql.SQLFeatureNotSupportedException: Feature not supported: getType. at com.github.mmolimar.ksql.jdbc.Exceptions$.wrapException(Exceptions.scala:83) at com.github.mmolimar.ksql.jdbc.resultset.ResultSetNotSupported.getType(ResultSet.scala:19) at groovy.sql.Sql.moveCursor(Sql.java:1277) at groovy.sql.Sql.eachRow(Sql.java:1259) at groovy.sql.Sql.eachRow(Sql.java:1219) at groovy.sql.Sql.eachRow(Sql.java:1156) at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318) at com.tcc.GroSandbox02Main.main(GroSandbox02Main.groovy:12)

Can you help me? Thank you very much for this work...

Jirka

JirHr avatar Sep 23 '21 12:09 JirHr

Yes, that feature is not supported yet in the driver and the getType method is called when iterating the result set with Groovy. You can iterate this result set in another way (Java/Scala style) and/or enable the feature in the class AbstractResultSet and returning ResultSet.TYPE_FORWARD_ONLY

mmolimar avatar Sep 23 '21 13:09 mmolimar