8

Hello, Python Community!

Has someone been able to successfully connect to an IBM Informix DB with a Python app? I have the following environment: DEV: Windows 11 Python 3.13.3 64-bit VS Code

DB: IBM Informix 12.10 hosted in Azure I'm able to connect to it usind DBeaver (JDBC)

I have tried the following libraries to try to establish the connection: ibm_db: Traceback (most recent call last): File "c:\Users\peterg\source\python\dbApp\ibm_db_test.py", line 1, in <module> import ibm_db as db ImportError: DLL load failed while importing ibm_db: The specified module could not be found._

pyodbc: I have an ODBC DSN connection established Traceback (most recent call last): File "c:\Users\peterg\source\python\dbApp\pyodbc_test.py", line 3, in <module> conn = db.connect("Dsn='DSN_NAME'") pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

JayDeBeAPI: I have downloaded the same JAR files as DBeaver uses and copied them to a dir local to the project and added the CLASSPATH variable: set "CLASSPATH=%PROJECT_ROOT%\Java\jbc-4.50.10.1.jar:%PROJECT_ROOT%\Java\bson-3.8.0.jar"

File "c:\Users\peterg\source\python\dbApp\JayDeBeApi_test.py", line 3, in <module> dbConn = db.connect("com.informix.jdbc.IfxDriver", "jdbc:informix-sqli://hostname:port/db_name:INFORMIXSERVER=server_name", ['user', 'pass']) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\jaydebeapi\__init__.py", line 412, in connect jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\jaydebeapi\__init__.py", line 221, in _jdbc_connect_jpype jpype.JClass(jclassname) ~~~~~~~~~~~~^^^^^^^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\jpype\_jclass.py", line 99, in __new__ return _jpype._getClass(jc) ~~~~~~~~~~~~~~~~^^^^ TypeError: Class com.informix.jdbc.IfxDriver is not found

PyInformix: SADeprecationWarning: The dbapi() classmethod on dialect classes has been renamed to import_dbapi(). Implement an import_dbapi() classmethod directly on class <class 'pyinformix.ifx_jdbc.InformixJDBCDialect'> to remove this warning; the old .dbapi() classmethod may be maintained for backwards compatibility. engine = create_engine('informix+ifx_jdbc://hostname:port/db_name;INFORMIXSERVER=server_name;delimident=y;user=user;password=pass') Traceback (most recent call last): File "c:\Users\peterg\source\python\dbApp\PyInformix_test.py", line 5, in <module> conn = engine.connect() File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\engine\base.py", line 3274, in connect return self._connection_cls(self) ~~~~~~~~~~~~~~~~~~~~^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\engine\base.py", line 146, in __init__ self._dbapi_connection = engine.raw_connection() ~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\engine\base.py", line 3298, in raw_connection return self.pool.connect() ~~~~~~~~~~~~~~~~~^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 449, in connect return _ConnectionFairy._checkout(self) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 1264, in _checkout fairy = _ConnectionRecord.checkout(pool) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 713, in checkout rec = pool._do_get() File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\impl.py", line 179, in _do_get with util.safe_reraise(): ~~~~~~~~~~~~~~~~~^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in __exit__ raise exc_value.with_traceback(exc_tb) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\impl.py", line 177, in _do_get return self._create_connection() ~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 390, in _create_connection return _ConnectionRecord(self) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 675, in __init__ self.__connect() ~~~~~~~~~~~~~~^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 901, in __connect with util.safe_reraise(): ~~~~~~~~~~~~~~~~~^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\util\langhelpers.py", line 146, in __exit__ raise exc_value.with_traceback(exc_tb) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\pool\base.py", line 897, in __connect self.dbapi_connection = connection = pool._invoke_creator(self) ~~~~~~~~~~~~~~~~~~~~^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\engine\create.py", line 646, in connect return dialect.connect(*cargs, **cparams) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\sqlalchemy\engine\default.py", line 625, in connect return self.loaded_dbapi.connect(*cargs, **cparams) # type: ignore[no-any-return] # NOQA: E501 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\jaydebeapi\__init__.py", line 412, in connect jconn = _jdbc_connect(jclassname, url, driver_args, jars, libs) File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\jaydebeapi\__init__.py", line 221, in _jdbc_connect_jpype jpype.JClass(jclassname) ~~~~~~~~~~~~^^^^^^^^^^^^ File "C:\Users\peterg\AppData\Local\Programs\Python\Python313\Lib\site-packages\jpype\_jclass.py", line 99, in __new__ return _jpype._getClass(jc) ~~~~~~~~~~~~~~~~^^^^ TypeError: Class com.informix.jdbc.IfxDriver is not found

IfxPy:

Uanble to install, seems that it does not support the latest Python 3 version.

Any help would be appreciated. I can attach the sample code of every method I tried if that would help.

you are viewing a single comment's thread
view the rest of the comments
[-] peterg75@discuss.online 2 points 1 week ago

I'm trying to connect to an existing DB hosted on IBM Informix Dynamic Server. Using Postgress is not an option in my case. I have not tried SQL Alchemy yet, but I suspect it'll have the same issues as it appears to be just a way of accessing other libraries (such as JDBC), which I am already having problems with.

[-] muntedcrocodile@lemm.ee 3 points 1 week ago

Ahh I see. Someone left u with some fucked tech debt. I can't help u as I only really use Linux and windows makes shit way harder than it needs to be. From ur tracelog I can see ur using sqlanchemy and it can't find the driver needed. Find a way to test if the driver and isolate the issue.

this post was submitted on 11 Apr 2025
8 points (90.0% liked)

Python

7010 readers
2 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS