I am doing a school project in which i need to connect to a database. I have no experience of doing this however after reseaching online i found using pyodbc would work. I am using a microsoft access for my database as it is the only software my school has. I installed the odbc driver and the pyodbc package but when I attempt to connect, I receive an error message
I tried using the following code to connect.
conn = pyodbc.connect('Driver={Microsoft Access Driver};Server=my servername;Database=mydbname;Trusted_Connection=yes;')
However i get the following error message
InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
I am not 100% sure i have used the right details in my connection string as I couldn't find a solid answer on where i would find my server name. I also tried using the following connection string.
conn = pyodbc.connect(
r"Driver={Microsoft Access Driver(*.mdb, *.accdb)};"
r"DBQ=C:\my_db_path.aacdb;"
r"PWD=mypassword;"
However I get the following error message
InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
Could anyone help me fix this issue as i have checked countless websites for help but nothing seems to work. Thanks