hsqldb raise a java.lang.IncompatibleClassChangeError when executing Open/Libre Office Uno XPreparedStatement.executeQuery()

2020-02-02 python hsqldb libreoffice uno

I had fun writing an Open/Libre Office Python extension gContactOOo allowing to recover these Google contacts under Open / Libre Office. To do this, I wrote a Driver, which loads when the protocol: sdbc:google:people is called and returns an interface com.sun.star.sdbc.XConnection

For this to work, I have to use a Python wrapper around the XConnection returned by the Driver, and must rewrite the XPreparedStatement.executeQuery() method such as:

def executeQuery(self):
   # TODO: cannot use: result = self.statement.executeQuery()
   # TODO: it trow a: java.lang.IncompatibleClassChangeError
   # TODO: fallback to: self.statement.execute()
   try:
       print("Connection.PreparedStatement.executeQuery() hack 1")
       return self.statement.executeQuery()
   except:
       pass
   try:
       print("Connection.PreparedStatement.executeQuery() hack 2")
       if self.statement.execute():
           return self.statement.getResultSet()
   except:
       pass
   try:
       print("Connection.PreparedStatement.executeQuery() hack 3")
       statement = self.connection.connection.createStatement()
       return statement.executeQuery(self.sql)
   except:
       pass
   print("Connection.PreparedStatement.executeQuery() hack 4")
raise SQLException()

I use Hsqldb version 2.5.0 (for versioning), but I have the same problem with version 2.4

This problem exceeds my skills, thank you for your help ...

Edit

If I use the openjdk-11-jre-headless for amd64 version (in place of Oracle JRE 1.8.0_201), the problem is the same, but the error message changes:

uno.com.sun.star.sdbc.SQLException: Receiver class org.hsqldb.jdbc.JDBCPreparedStatement does not implement the interface java.sql.CallableStatement defining the method to be called (org.hsqldb.jdbc.JDBCPreparedStatement is in unnamed module of loader java.net.URLClassLoader @2e7290b4; java.sql.CallableStatement is in module java.sql of loader 'platform') PreparedStatement.executeQuery() ERROR: Receiver class org.hsqldb.jdbc.JDBCPreparedStatement does not implement the interface java.sql.CallableStatement defining the method to be called (org.hsqldb.jdbc.JDBCPreparedStatement is in unnamed module of loader java.net.URLClassLoader @2e7290b4; java.sql.CallableStatement is in module java.sql of loader 'platform') - None

Maybe this message will seem more explicit to someone?

Answers

Related