pypyodbc has worked for me in the past, but for some reason it's not working. I have this defined in ~/.odbc.ini
[as400]
Description = IBM i Access ODBC Driver
Driver = IBM i Access ODBC Driver
System = mysystem
UserID = myuser
Password = mypass
Naming = 0
DefaultLibraries = QGPL
Database =
ConnectionType = 0
CommitMode = 2
ExtendedDynamic = 1
DefaultPkgLibrary = QGPL
DefaultPackage = A/DEFAULT(IBM),2,0,1,0,512
AllowDataCompression = 1
MaxFieldLength = 32
BlockFetch = 1
BlockSizeKB = 128
ExtendedColInfo = 0
LibraryView = ENU
AllowUnsupportedChar = 0
ForceTranslation = 0
Trace = 0
And can connect just fine with $ isql as400
.
However with the following program:
import pypyodbc
conn = pypyodbc.connect("Driver={as400};System=mysystem;Uid=myuser;Pwd=mypass;")
I get this error:
Traceback (most recent call last):
File "dbtest.py", line 3, in <module>
conn = pypyodbc.connect("Driver={as400};System=mysystem;Uid=myuser;Pwd=mypass;")
File "/home/wwerner/.virtualenvs/devtools/lib/python3.4/site-packages/pypyodbc.py", line 2435, in __init__
self.connect(connectString, autocommit, ansi, timeout, unicode_results, readonly)
File "/home/wwerner/.virtualenvs/devtools/lib/python3.4/site-packages/pypyodbc.py", line 2484, in connect
check_success(self, ret)
File "/home/wwerner/.virtualenvs/devtools/lib/python3.4/site-packages/pypyodbc.py", line 988, in check_success
ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi)
File "/home/wwerner/.virtualenvs/devtools/lib/python3.4/site-packages/pypyodbc.py", line 964, in ctrl_err
raise Error(state,err_text)
pypyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified')
I tried looking in the pypyodbc source for some way to mirror the isql -v
ability but VERBOSE = True
wasn't it. I also found a bug that apparently it used to just send the first letter and thought maybe somehow I've got that issue, but I couldn't figure out where I'd find that.
How can I get this working again?