Cannot make connection to accdb file using python

0 votes

I am writing a script that needs to make a connection to a microsoft access .accdb file and extract data from it.

Here is a snippet of what I am doing?

import pypyodbc
pypyodbc.lowercase = False

conn = pypyodbc.connect(
       r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};' +
       r'DBQ=file.accdb;'
       )
cur = conn.cursor()

I get the following error:

    raise Error(state,err_text)
pypyodbc.Error: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified')

I have installed the drivers for ODBC as instructed in https://docs.microsoft.com/en-us/sql/connect/python/pyodbc/step-1-configure-development-environment-for-pyodbc-python-development

But the error persists, any idea what should I do or where I am going wrong?

Oct 5, 2018 in Python by eatcodesleeprepeat
• 4,710 points
540 views

1 answer to this question.

0 votes

That link has instructions for connecting to SQL Server, not Access. The error message suggests that you working on a Windows machine. 

answered Oct 5, 2018 by Priyaj
• 58,090 points

Related Questions In Python

0 votes
0 answers

Cannot make connection to .accdb file using python

I am writing a script that needs ...READ MORE

Jun 7, 2018 in Python by aryya
• 7,450 points
1,652 views
0 votes
1 answer

Cannot make connection to .accdb file using python

key is just a variable name. for key in ...READ MORE

answered Sep 21, 2018 in Python by charlie_brown
• 7,720 points
625 views
+2 votes
2 answers

How to make a laplacian pyramid using OpenCV python?

down voteacceptTheeThe problem is that you're iterating ...READ MORE

answered Apr 3, 2018 in Python by charlie_brown
• 7,720 points
4,487 views
0 votes
1 answer

Python using basicConfig method to log to console and file

I can't reproduce it on Python 3.3. ...READ MORE

answered Aug 14, 2018 in Python by aryya
• 7,450 points
876 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,070 views
0 votes
1 answer
0 votes
1 answer

Python using basicConfig method to log to console and file

Try this working fine(tested in python 2.7) ...READ MORE

answered Aug 27, 2018 in Python by Priyaj
• 58,090 points
9,601 views
+2 votes
3 answers

How can I play an audio file in the background using Python?

down voteacceptedFor windows: you could use  winsound.SND_ASYNC to play them ...READ MORE

answered Apr 4, 2018 in Python by charlie_brown
• 7,720 points
12,942 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP