0

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?

psilocybe
  • 35
  • 6
  • Sounds like two problems, one is that the driver seems to be too old to have all the JDBC 4.2 features. In the past this was no problem, but with later java verifications fail. Short workaround would be -XX:-BytecodeVerificationLocal. The other think might be fixed by adding a module open, not actualy sure what python does. `--add-opens java.base/java.sql.CallableStatement=ALL-UNNAMED` (maybe the second helps with the first without hsqldb update). Or just stick with Java 8? :) – eckes Jan 01 '21 at 03:32
  • Yeah probably does not make sense. On second reading sounds mentioned 8 and update already. I was actually explaining it for my wife. She needs the function, but I dot have the nerve to actually try it out, – eckes Jan 03 '21 at 22:41
  • Hi eckes, thanks for this answer but I don't understand what you are trying to explain to me: 1- what is `-XX:-BytecodeVerificationLocal` 2- How to add `a module open`. Sorry but I don't understand much about Java ... – psilocybe Jan 03 '21 at 22:48
  • The Bytecode verifier alerts in later java versions if it cannot load all interface super types (even if unused). This might help with that Callable Interface from your exception, but as I said, havent tested it. – eckes Jan 04 '21 at 00:12

0 Answers0