Error connecting SikuliX 2.0.5 to sqlserver using zxJDBC

Asked by Kyle Winmill on 2021-05-19

My team at work has been using this below to successfully connect to our database and execute a query for 5 years now:

from com.ziclix.python.sql import zxJDBC
connection = zxJDBC.connect('jdbc:sqlserver://', 'xxx', 'xxx','')
cursor = connection.cursor()
SQLCommand = importQuery.readFile('C:\\testQuery.sql')
result = list(cursor)

After this, we then loop through each row and execute tests based off of the results that we get from our query.

This has never worked with SikuliIDE-2.0.0 or later, and we haven't been able to get it to connect with the new versions, so we stuck with 1.1.2 as we had the least issues with that version. With the latest Java update we are no longer able to use the older versions and want to update to the latest version of Sikuli, 2.0.5.

When I run in 2.0.5, I get the following error on the second line (from com.ziclix.python.sql import zxJDBC):

[error] script [ 1389693genExY&YTforWorksheetOnlyRerunInY ] stopped with error in line 56
[error] java.lang.NoClassDefFoundError ( java.lang.NoClassDefFoundError: Could not initialize class com.ziclix.python.sql.zxJDBC )
[error] --- Traceback --- error source first
line: module ( function ) statement
56: main ( <module> ) from com.ziclix.python.sql import zxJDBC
[error] --- Traceback --- end --------------

We have tried updating the jdbc jar to mssql-jdbc-9.2.1.jre15.jar, and changed our first line to reference that, with just the name of it and with putting in the full path before it (although it used to always work without the path, just with load("sqljdbc4-2.0.jar"), but without success.

We also tried following the solution from without success.

Any help would be greatly appreciated!

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :

Sorry, but with 2.0.5 the load() feature does not work anymore as expected, since entries to the Java class path from inside a Java program are no longer allowed.

You have to setup the Java class path and IDE start on the command line for example like so:

java -cp mystuff1.jar;mystuff2.jar;<sikulix-ide-jar> org.sikuli.ide.Sikulix ... optional parameters ...

Can you help with this problem?

Provide an answer of your own, or ask Kyle Winmill for more information if necessary.

To post a message you must log in.