Forums

ODBC for IBM iSeries to connect to DB2 database

Hello Team,

Can you please guide me how I can install ODBC driver for connecting my IBM db2 database. I did coding in Web2py and my laptop has that ODBC driver installed and thus I am able to connect and operate on my database. How can I achieve the same on PA? The error is: InterfaceError: ('IM002', u'[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

What library are you using on your local machine? Have you tried to install it on PythonAnywhere?

Thanks for replying so quickly on this.

So I am not sure on that part but I guess it should be Pyodbc... I am not sure because when I was importing pyodbc it was giving me error in local as well module not found. but I am using this below connection string.

db=DAL('db2:pyodbc://DSN=Modlsys;UID=username;PWD=pwd',pool_size=10,migrate_enabled=True,check_reserved=['all']) where Modlsys is my driver name which I have installed in my system.. Should I replace the DSN with host?

You need to refer to the documentation of the interface that you are using.

I am using WEB2Py and from that documentation only I used that DAL conncetion string format. Although after I post here I changed that driver and now new error is thrown. from Web2Py: DB2 db2://username:password@test

and I used the same. My current DAL is db=DAL('db2:pyodbc://DRIVER={iSeries Access ODBC Driver};System=10.10.4.43;UID=username;PWD=pwd' ,pool_size=10,migrate_enabled=True,check_reserved=['all'])

and the error now thrown is : Error: ('01000', u"[01000] [unixODBC][Driver Manager]Can't open lib 'iSeries Access ODBC Driver' : file not found (0) (SQLDriverConnect)")

Can you help?

I don't have any good ready advice. Where is the database server you want to connect to?

The database server is my Company's IBM i Server (AS400) located in USA.

As you are on free account you won't be able to connect to the machine that is not whitelisted.

I guess it is more related to driver. This is the error I am getting Error: ('01000', u"[01000] [unixODBC][Driver Manager]Can't open lib 'iSeries Access ODBC Driver' : file not found (0) (SQLDriverConnect)")

Can PythonAnywhere team can add a new driver related to IBM iSeries Db2 accessing and we can use the same as the driver. It is mostly the driver issue

If the driver you require does not require root access to be installed you can do it yourself. We won't be able to install anything system-wide till late spring/early summer when we create a new system image. Anyway, you will hit the whitelist problem even if your driver is installed.