Connecting to a DB in Sikuli- is there a widely used method for Sikuli 2.0.5?

Asked by mpayne

Hi, I have connected to a DB in Sikuli before the 2.X versions. In the 2.0.5 version, I can no longer get my scripts to connect to the DB. For reference, the issue I get is similar to this: https://answers.launchpad.net/sikuli/+question/202408
I have tried changing the classpath via launching Sikuli using cmd files as is suggested in that question, this has not solved the issue.
I have used zxJDBC.jar for connecting.

Is there a standard way people have been able to connect to DB in the 2.0.5 version? I can't find anything that helps but I could easily be looking in the wrong places.

Any help/suggestions appreciated. I will include below a snippet of how I have connected to DB in the past.

from com.ziclix.python.sql import zxJDBC
connection = zxJDBC.connect(DB URL, Username, Password,'com.microsoft.sqlserver.jdbc.SQLServerDriver')
cursor = connection.cursor()

Thank you.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
mpayne
Solved:
Last query:
Last reply:
Revision history for this message
mpayne (mpayne00) said :
#1

Found the solution and it's insultingly simple...

In order for sikuli to use zxJDBC.jar and sqljdbc.jar, they must be put into the following location:
C:\Users\username\AppData\Roaming\Sikulix\Extensions

Sikuli 2.0.5 has the zxJDBC.jar with it, but it is in the Sikulix\Lib folder. I moved this to extensions and downloaded the latest sqljdbc.jar driver. With both jar files in the extensions folder, the following code still connects to the database:

from com.ziclix.python.sql import zxJDBC
connection = zxJDBC.connect(DB URL, Username, Password,'com.microsoft.sqlserver.jdbc.SQLServerDriver')
cursor = connection.cursor()

Hope this helps somebody else.