I have a working pyodbc connection to a i5/OS database and now I would like to use sqlalchemy.
According to these sites it should be possible:
- http://corylutton.com/SQLAlchemy_Cherrypy_and_iSeries.html
- https://github.com/exedre/ibm-db/tree/master/IBM_DB/ibm_db
- Connecting to IBM AS400 server for database operations hangs
I tried it with 3.5.2 as well as with a Python 2.7.12.
import pyodbc
import ibm_db_sa
from sqlalchemy import *
db = create_engine('ibm_db_sa+pyodbc://username:password@database/*local')
In Python2 I get:
return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
In Python3 I get:
connectors.extend(['%s=%s' % (k,v) for k,v in keys.iteritems()])
AttributeError: 'dict' object has no attribute 'iteritems'.
Could anyone confirm that it is even possible to connect a AS/400 i-Series and if so put me in the right direction. I tried a lot of different things. Thanks in advance.