I have to connect to a DB2 to extract some data and create a Tableau Data Extract, in order to do this I wanted to use JayDeBeApi, and to test it I was trying to connect myself to a small Postgres database, but I can't establish a proper connection to it because it throws me all the time the following error:
jpype._jexception.RuntimeExceptionPyRaisable: java.lang.RuntimeException: Class org.postgresql.Driver not found
My current implementation is this
import jaydebeapi as jdbc
sql = 'Select * From world.city'
postgresql_class = 'org.postgresql.Driver'
postgresql_jdbc_path = 'path/to/postgresql-42.2.4.jar'
postgresql_url = 'jdbc:postgresql://host:port/database'
postgresql_user = 'user'
postgresql_pw = 'pass'
conn = jdbc.connect(postgresql_class,
[postgresql_url, postgresql_user, postgresql_pw],
postgresql_jdbc_path)
curs = conn.cursor()
curs.execute('SELECT * FROM csv_reports LIMIT 2')
curs.fetchall()
curs.close()
conn.close()
Does anyone know what class do I have to specify in order to make this work? Or how do i have to specify the jdbc path so that JayDeBeApi can use the class or something