jpype._jexception.RuntimeExcepti
2018-04-09 本文已影响491人
什锦甜
-
Two connections problem with jaydebeapi.
Description: when setting up two databases at the same time with jaydebeapi, it occurs the following error:
-
How to fix this problem?
my original code:
conn_mysql = jaydebeapi.connect("com.mysql.jdbc.Driver",
"jdbc:mysql://[hostname]:[port]/[database]",
["username", "password"],
"/Users/yt/Downloads/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46.jar",)
conn_postgre = jaydebeapi.connect("org.postgresql.Driver",
"jdbc:postgresql://[hostname]:[port]/[database]",
["username", "password"],
"/Users/yt/Downloads/postgresql-42.2.2.jar",)
I specify path for all JDBC drivers my program requires in both calls to jdbc.connect(). I change the code like following and it works:
conn_mysql = jaydebeapi.connect("com.mysql.jdbc.Driver",
"jdbc:mysql://[hostname]:[port]/[database]",
["username", "password"],
["/Users/yt/Downloads/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46.jar","/Users/yt/Downloads/postgresql-42.2.2.jar"],)
conn_postgre = jaydebeapi.connect("org.postgresql.Driver",
"jdbc:postgresql://[hostname]:[port]/[database]",
["username", "password"],
["/Users/yt/Downloads/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46.jar","/Users/yt/Downloads/postgresql-42.2.2.jar"],)