美文网首页我爱编程
jpype._jexception.RuntimeExcepti

jpype._jexception.RuntimeExcepti

作者: 什锦甜 | 来源:发表于2018-04-09 16:55 被阅读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"],)

相关文章

网友评论

    本文标题:jpype._jexception.RuntimeExcepti

    本文链接:https://www.haomeiwen.com/subject/jhbihftx.html