Accessing a JET (.mdb) database in Python

拜拜、爱过 提交于 2019-11-29 12:29:43

问题


Is there a way to access a JET database from Python? I'm on Linux. All I found was a .mdb viewer in the repositories, but it's very faulty. Thanks


回答1:


MDB Tools is a set of open source libraries and utilities to facilitate exporting data from MS Access databases (mdb files) without using the Microsoft DLLs. Thus non Windows OSs can read the data. Or, to put it another way, they are reverse engineering the layout of the MDB file.

Jackcess is a pure Java library for reading from and writing to MS Access databases. It is part of the OpenHMS project from Health Market Science, Inc. . It is not an application. There is no GUI. It's a library, intended for other developers to use to build Java applications.

ACCESSdb is a JavaScript library used to dynamically connect to and query locally available Microsoft Access database files within Internet Explorer.

Both Jackcess and ACCESSdb are much newer than MDB tools, are more active and have write support.




回答2:


Install your distribution's packaged version of mdbtools, use mdb-export to export the Jet data to text files, import the data into a SQLite database, and have a combination of code and data that works in almost any computing environment you might get your hands on.




回答3:


Probably the most simple solution:

  1. Download VirtualBox and install Windows and MS access in it.

  2. Write a small Python server which use ODBC to access the database and which receives commands from a network socket.

  3. On Linux, connect to the server in the virtual machine and access the database this way.

This gives you full access to all features. Every other solution will either limit the features you can use (for example, you won't be able to modify the data) or be pretty unsafe.




回答4:


If you build the CVS version of mdb-tools, it works rather well. It fixed a lot of issues I had trying to use the one in the repositories related to memo field size. mdb-tools is basically a dead project, but people have still been occasionally contributing code to the CVS. The build in Ubuntu is from 2004 I think.

CVS instructions here:

http://sourceforge.net/scm/?type=cvs&group_id=2294

If using Ubuntu, before downloading the sources you'll want to enable source repositories and do:

apt-get build-dep mdbtools

That will get the required packages you'll need to manually build the sources from CVS.



来源:https://stackoverflow.com/questions/2559659/accessing-a-jet-mdb-database-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!