Python - Unable to connect to 2 different databases like hive and iris in same python program

130 views Asked by At

I am trying to connect to hive database and IRIS Intersystems Databases using jaydebeapi in python. I am able to connect to one database at a time. While trying to connect to other database, I am getting the below error

"Class org.apache.hive.jdbc.HiveDriver is not found" or "Class com.intersystems.jdbc.IRISDriver is not found"

lin1 - hive_con = jd.connect(java_driver_class, jdbc_conn_url, [hive_user, hive_pass],jarfile)

lin2 - iris_con = jd.connect(iris_driver_class, iris_conn_url, [iris_user, iris_pass],jarfile)

If I try to execute the above code, only the first lin1 executes and the other one gives out exception.

If I comment out the first line, then second line lin2 works fine. I tried to close one connection before opening the other, still the issue is same. I want the the both connections to work in same program.

1

There are 1 answers

1
user21174324 On

Just pass in both jar files like this: jar_files = [jar1, jar2] lin1 - hive_con = jd.connect(java_driver_class, jdbc_conn_url, [hive_user, hive_pass],jar_files)

lin2 - iris_con = jd.connect(iris_driver_class, iris_conn_url, [iris_user, iris_pass],jar_files)