NoSuchMethodException using custom timestamp class


I am developing a new Metabase DB driver. I’ve successfully compiled and installed the jar file (and my JDBC driver) and can issue successful native queries against my DB for columns of type ‘int’, ‘float’, and ‘varchar’.

However I get the following error querying ‘timestamp’ columns. Our JDBC driver uses custom classes for TIMESTAMP (com.ocient.jdbc.XGTimestamp) and TIME (com.ocient.jdbc.XGTime) column types. These both reside in the driver jar file.

{:type “native”,
native {:query “select localdatetime from weather.stations limit 10”, :template-tags {}},
database 6,
parameters [],
middleware {:js-int-to-string? true, :add-default-userland-constraints? true}},
status :failed,
class java.lang.NoSuchMethodException, <==============
[“java.base/java.lang.Class.getConstructor0(Unknown Source)”
“java.base/java.lang.Class.getConstructor(Unknown Source)”
“–> driver.sql_jdbc.execute$get_object_of_class_thunk$fn__77593.invoke(execute.clj:278)”
context :ad-hoc,
error “java.time.LocalDateTime.(com.ocient.jdbc.XGTimestamp)”, <=================

I tried using the driver method that maps database types to base types, but had no luck with this.

Any help would be much appreciated!

Hello @hcalzaretta, take a look at the sql-jdbc read-column-thunk methods. There might be more elegant methods to address your issue, but I think it might be a potential starting point.

Thanks @enqueue! I tried implementing the read-column-thunk method but I got this error compiling the driver:

Unable to resolve symbol: read-column-thunk in this context

I'll have to do more digging into this.

Thanks for your help!
Hank Calzlaretta

1 Like