Skip to content Skip to sidebar Skip to footer

Connection Error To Access Database

I wrote the program which by means of pyodbc is connected to Access to that it was very glad. Help me please. import pyodbc #import kinterbasdb import firebirdsql import os, sys im

Solution 1:

The driver name you specified...

DRIVER={Microsoft Access Driver (*.accdb)}

...is incorrect. There is no ODBC driver with that name. 32-bit applications that want to open an older .mdb database file can use

Driver={Microsoft Access Driver (*.mdb)}

To open an .mdb file from a 64-bit application, or to open an .accdb file from any application, you need to use

Driver={Microsoft Access Driver (*.mdb, *.accdb)}


Solution 2:

It looks like you do not have connected to the DB. Maybe you should begin with a smaller program just to connect. Samples in other questions : Using Microsoft Access SQL operators in Python ODBC


Solution 3:

This might help.

import pyodbc

# Connect to your access database file

DBfile = 'Filename.mdb'  # Let your file name <Filename> and access extension .mdb
conn = pyodbc.connect('DRIVER={Microsoft Access Driver (*.mdb)};DBQ='+DBfile)  #    user/password can be used
cur = conn.cursor()

# Create new table in database

cur.execute ('CREATE TABLE CLIENTS (ID INTEGER, COMPANY STRING)')
conn.commit()

cur.close()
conn.close()

Post a Comment for "Connection Error To Access Database"