PyODBC to Oracle 19 Version Connectivity issue on RHEL7 and RHEL8 linux servers in Python virtual environment #1178
Unanswered
AASupport123
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Does |
Beta Was this translation helpful? Give feedback.
1 reply
-
If you want to access an Oracle database from Python you might find it more convenient to use oracledb instead of pyodbc. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
PyODBC to Oracle driver connection is getting failed with the error message 'pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')' on RHEL7 and RHEL8 linux servers.
We have tried using Oracle 19 version connectivity from python 3.7/3.9 versions using PyODBC on RHEL7 and RHEL8 servers. Please find the below connection code, odbc.ini & tnsnames.ora entry details on server and error message we received when trying the connectivity under virtual environment in python.
Connection Code:
import pyodbc
import os
import pandas as pd
os.environ["ORACLE_HOME"] = "/trvapps/oracle/product/client_64/19c/client"
from ctypes import *
lib1 = cdll.LoadLibrary('/trvapps/oracle/product/client_64/19c/client/lib/libclntsh.so.19.1')
cnxn = pyodbc.connect('DSN=xxx;''uid=xxx;''pwd=xxx;')
cursor = cnxn.cursor()
Error Message:
pyodbc.InterfaceError: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found and no default driver specified (0) (SQLDriverConnect)')
Content in tnsnames.ora file :
EBITS_ora =
(DESCRIPTION =
(ADDRESS = (COMMUNITY = TCP)(PROTOCOL = TCP)(Host =xxx)(Port = xxx))
(CONNECT_DATA =
(SERVICE_NAME = xxx)
(SERVER = DEDICATED)
)
)
Content in odbc.ini file:
[EBITS_ora]
Driver=/trvapps/oracle/product/client_64/19c/client/lib/libsqora.so.19.1
DriverUnicodeType=1
Description=Oracle ODBC Database
ServerName=EBITS_ora
Beta Was this translation helpful? Give feedback.
All reactions