In a Python script with pyodbc, I am trying to connect to a still used Access 97 database on our network but I have problems to get the connection (or the connection string) to work.
I keep getting the following error:
pyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnectW)')
This is my connection string which fails with above mentioned error:
conn = pyodbc.connect('Driver={Microsoft Access Driver (.mdb)};Provider=Microsoft.Jet.OLEDB.4.0;Password=mypassword;User ID=myusername;dbq=\\fileserver\\conta\\locationdir\\mydatabase_be.mdb;Persist Security Info=True;Jet OLEDB:System database=\\FILESERVER\\backend\\mdw\\system.mdw')
As you can see, this connection requires to use a System database (workgroup - mdw). The database is on a network-storage.
I am using Python 2.7.
Can anyone help?
EDIT: in the connection-string, the backslashes should be double backslashes. It seems like only a single backslash is shown.
OK, I got it sorted. My solution was based on the following snippet (was just a matter of getting the syntax right):
Solution found in this web-page
Hope this may be useful for someone else.