How to connect Python Django to Informix DB on a remote Windows Server

I need to connect my Django app to the Informix db I have an Informix db installed on a VM Windows server 2019 Datacenter I can access the db through dbvisualiser on my laptop I installed the Informix client SDK on my laptop in the Programs Files directory

I tried this settings https://pypi.org/project/django-informixdb/

**In my settings.py **

DATABASES = {
    'default': {
        'ENGINE': 'django_informixdb', 
        'NAME': 'testdb', 
        'SERVER': "ol_test",
        'HOST': '172.20.10.3',
        'PORT': '9092',
        'USER': 'informix',
        'PASSWORD': 'test@12345',
        'OPTIONS': {
            'DRIVER': "C:\\Program Files\\IBM Informix Client-SDK\\bin\\iclit09b.dll", # Or iclit09b.dylib on macOS
            'Setup': "C:\\Program Files\\IBM Informix Client-SDK\\bin\\iclit09b.dll",
            'CPTIMEOUT': 120,
            'CONN_TIMEOUT': 120,
            'ISOLATION_LEVEL': 'READ_UNCOMMITTED',
            'LOCK_MODE_WAIT': 0,
            'VALIDATE_CONNECTION': True,
        },
        'CONNECTION_RETRY': {
            'MAX_ATTEMPTS': 10,
        },
        'TEST': {
            'NAME': 'testdb',
            'CREATE_DB': False
        }
    }
}

I got this error C:\Users\test\PycharmProjects\bdm_reporting_app\bdm_reporting_app\settings.py changed, reloading. Watching for file changes with StatReloader Performing system checks...

System check identified no issues (0 silenced). Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 282, in ensure_connection self.connect() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\asyncio.py", l ine 26, in inner return func(*args, **kwargs) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 263, in connect self.connection = self.get_new_connection(conn_params) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django_informixdb\base.py", line 251, in get_new_connection self.connection = self._get_connection_with_retries(connection_string, conn_params) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django_informixdb\base.py", line 299, in _get_connection_with_retries conn = pyodbc.connect(connection_string, autocommit=conn_params["AUTOCOMMIT"], pyodbc.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no def ault driver specified (0) (SQLDriverConnect)')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_i nner self.run() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run self._target(*self._args, **self._kwargs) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\autoreload.py" , line 64, in wrapper fn(*args, **kwargs) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\comm ands\runserver.py", line 137, in inner_run self.check_migrations() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\core\management\base .py", line 564, in check_migrations executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS]) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\execut or.py", line 18, in init self.loader = MigrationLoader(self.connection) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\loader .py", line 58, in init self.build_graph() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\loader .py", line 235, in build_graph self.applied_migrations = recorder.applied_migrations() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\record er.py", line 81, in applied_migrations if self.has_table(): File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\migrations\record er.py", line 57, in has_table with self.connection.cursor() as cursor: File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\asyncio.py", l ine 26, in inner return func(*args, **kwargs) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 323, in cursor return self._cursor() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 299, in _cursor self.ensure_connection() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\asyncio.py", l ine 26, in inner return func(*args, **kwargs) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 281, in ensure_connection with self.wrap_database_errors: File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\utils.py", line 9 1, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 282, in ensure_connection self.connect() File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\utils\asyncio.py", l ine 26, in inner return func(*args, **kwargs) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django\db\backends\base\bas e.py", line 263, in connect self.connection = self.get_new_connection(conn_params) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django_informixdb\base.py", line 251, in get_new_connection self.connection = self._get_connection_with_retries(connection_string, conn_params) File "C:\Users\test\AppData\Local\Programs\Python\Python310\lib\site-packages\django_informixdb\base.py", line 299, in _get_connection_with_retries conn = pyodbc.connect(connection_string, autocommit=conn_params["AUTOCOMMIT"], django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found a nd no default driver specified (0) (SQLDriverConnect)')

Back to Top