0

I am using jaydebeapi in python 3 to run queries. I need to connect to Netezza and MySql both. my code runs both queries separately without any problem but when I run one after another it gives an error for the second one. I close both connection and cursor for the first query (Netezza) but still get the following error:

jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class com.mysql.jdbc.Driver not found
Mostafa Ghafoori
  • 187
  • 2
  • 3
  • 13

2 Answers2

0

The issue isn't that you need to close one connection in order to use the other. The issue is that, when jaydebeapi is using jpype for communication, you only get one opportunity to provide all of the necessary JAR file paths you may use. This can be seen in the _jdbc_connect_jpype function, here.

The fix is to pass all JAR file paths you may use during execution of your program.

I'm assuming you aren't running on Jython and instead jaydebeapi automatically installed jpype to facilitate Python to Java communication. This is the most likely scenario for an "out of the box" situation. If you are using Jython, let me know.

joebeeson
  • 4,159
  • 1
  • 22
  • 29
0

Yu need add Class Mysql Driver and JAR file path, example to DB2 with IMB jar:

conn = jaydebeapi.connect("com.ibm.as400.access.AS400JDBCDriver", "url", ["user", "password"], "C:\lib\jt400.jar",)