traccar - H2 database - python connection
by kzo81 from LinuxQuestions.org on (#5Q5Q7)
Hi,
I'm running Traccar in docker and I'd like to connect to its H2 database within the container.
this is my initial code:
Code:
import jaydebeapi
conn = jaydebeapi.connect("org.h2.Driver",
"jdbc:h2:/home/user/Documents/traccar/target/database",
["sa", ""],'/usr/local/openjdk-11')
curs = conn.cursor()
conn.close()this is the error message:
Code: File "dbmanager.py", line 5, in <module>
["sa", ""])
File "/usr/local/lib/python3.7/dist-packages/jaydebeapi/__init__.py", line 412, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/usr/local/lib/python3.7/dist-packages/jaydebeapi/__init__.py", line 221, in _jdbc_connect_jpype
jpype.JClass(jclassname)
File "/usr/local/lib/python3.7/dist-packages/jpype/_jclass.py", line 99, in __new__
return _jpype._getClass(jc)
TypeError: Class org.h2.Driver is not foundI also tried to initialise it with "com.mysql.cj.jdbc.Driver" however I couldnt establish connection.
Could you please help me?
I'm running Traccar in docker and I'd like to connect to its H2 database within the container.
this is my initial code:
Code:
import jaydebeapi
conn = jaydebeapi.connect("org.h2.Driver",
"jdbc:h2:/home/user/Documents/traccar/target/database",
["sa", ""],'/usr/local/openjdk-11')
curs = conn.cursor()
conn.close()this is the error message:
Code: File "dbmanager.py", line 5, in <module>
["sa", ""])
File "/usr/local/lib/python3.7/dist-packages/jaydebeapi/__init__.py", line 412, in connect
jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs)
File "/usr/local/lib/python3.7/dist-packages/jaydebeapi/__init__.py", line 221, in _jdbc_connect_jpype
jpype.JClass(jclassname)
File "/usr/local/lib/python3.7/dist-packages/jpype/_jclass.py", line 99, in __new__
return _jpype._getClass(jc)
TypeError: Class org.h2.Driver is not foundI also tried to initialise it with "com.mysql.cj.jdbc.Driver" however I couldnt establish connection.
Could you please help me?