0

I have tried to connect to DB2 with python using JDBC with the code below but somehow it shows me the error

My code:

import jaydebeapi
import jpype
jaydebeapi.connect('com.ibm.db2.jcc.DB2Driver','jdbc:db2://host:port/database',['username','password'],'Location of jar db2jcc-db2jcc4.jar')

Error Error

To give more context on it I have used jaydebeapi package and also tried the solution provided in one of the stack overflow solution but still having the same issues. Error importing jpype module. Moreover I am using Pycharm as my IDE

  • 1
    Not enough facts in your question. Please edit your question to improve it. Why are you trying jaydebaapi? Why not use the default python ibm_db (which does not use java) instead? How did you install jaydebapi? Have you tried to use it __outside of pycharm__ , that is, at the CMD.EXE prompt (to eliminate temporarily any pycharm trouble). – mao Mar 23 '23 at 10:35
  • @mao Thanks for clarifying. I am using jaydebaapi because our DB2 is on the remote server which can only be accessed through JDBC only with its config in the jar file so I don't have much room left for the ibm_db library. Moreover, I have installed jaydebapi packages by downloading and adding them through add packages in Pycharm. Yes, I have used it cmd.exe but it returns the same result. – Rutvij Dave Mar 23 '23 at 10:49
  • Please edit your question, instead of using comments, to add clarifications,explanations etc. Respect that. The error happens typically because the PATH environment variable is not correctly set at the time the import runs. – mao Mar 23 '23 at 10:59

0 Answers0