Search code examples
pyodbcibm-midrange

pyodbc DSN-less connection with AS400 / IBM midrange


I want to connect via pyodbc with a AS400 Database. I configured it via the DSN syntax and it is working, but I need it DSN less.

This my current code:

connection = pyodbc.connect(
  driver='{iSeries Access ODBC Driver}',
  system='192.***.***.***',
  uid='U******',
  pwd='p0*****')

But always I got the error:

('HY000', '[HY000] [IBM][System i Access ODBC Driver]Missing system name needed for connection. (30188) (SQLDriverConnect); [HY000] [IBM][System i Access ODBC Driver]Missing system name needed for connection. (30188)')

I already tried it with the older driver "IBM i Access ODBC Driver" but same error is comming up.

Did someone also had this error?

Thanks


Solution

  • in my case - I just need to use capital letters for the functions variables:

    connection = pyodbc.connect(
      DRIVER='{iSeries Access ODBC Driver}',
      SYSTEM='192.***.***.***',
      UID='U******',
      PWD='p0*****')