connect to Oracle11g DB from pypyodbc

1.3k views Asked by At

Am relatively beginner level python dev here. I am just not able to connect to Oracle from pypyodbc

import pypyodbc as pyodbc
connstr = 'DSN = IDW;PWD=XXXXX'
connection = pyodbc.connect(connstr)

errs out with the below:

File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\eclipse-standard-luna-R-win32-x86_64\eclipse\plugins\org.python.pydev_4.1.0.201505270003\pysrc\pydevd.py", line 1709, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
File "C:\Users\PRXM\workspace\tests\gettingstarted.py", line 10, in <module>
    connection = pyodbc.connect(connstr)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 2434, in __init__
    self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 2483, in connect
    check_success(self, ret)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 988, in check_success
    ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
File "C:\Users\PRXM\Desktop\JobReadings\PythonIDE\Anaconda_64\lib\site-packages\pypyodbc.py", line 964, in ctrl_err
    raise Error(state,err_text)
pypyodbc.Error: (u'IM002', u'[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified')
1

There are 1 answers

1
oracle On

Try this:

Connection_String = 'Driver={Oracle in OraClient11g_home1};DBQ=MyDB;Uid=MyUser;Pwd=MyPassword;'