質問

I have been having problems accessing a MS Access 2013 database using pyodbc. The connection string is:

conn = pyodbc.connect("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=E:\\testmodel.accdb;")

what I am getting as an error is:

pyodbc.Error: ('HY000', "[HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process

Help please! I have seen it work with 2007 db... can it work with 2013?

Thanks! Jon

役に立ちましたか?

解決

Whenever I see that error message it's usually because I also have the database open in Access itself and I have done something that has essentially "locked" the database, like opening an object in Design View or having made changes to a VBA module. Make sure that you have no open instances of the Access application itself and try again.

Another possible cause is that the root folder of some drives can have restricted permissions. You could try moving the .accdb file to a location where all users normally have read/write access, e.g.,

C:\Users\Public\Documents

and see if that helps.

他のヒント

My guess is that Python and Ms Access 2013 are one on 32bit and the other on 64. If this is the case they are incompatible and throw an error. MsAccess 2013 (64bit) provides only the 64 version of the driver so if your Python is on 32 you may have to either reload your python on the 64bit version or modify your MS Access. It may be possible to have both versions of the MS Access Driver installed on the same machine, but it's not advisable since MS Office may became unstable. Hope it helps and good luck

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top