如何使用Linux的MS-Access文件?

时间:2021-11-09 11:49:59

I'm studying an introductory course in databases and one of the exercises is to work with MS-Access. However I'm using Linux at home and although I can use the computer classes at the university it is far from convenient (limited open time - my studying time is mostly nights).

我正在学习数据库的入门课程,其中一个练习是使用MS-Access。然而,我在家里使用Linux,虽然我可以在大学使用计算机课程,但这并不方便(开放时间有限 - 我的学习时间大多是晚上)。

So how can I use an Access file (*.mdb) in Linux? By use I mean changing tables, writing queries and so on.

那么如何在Linux中使用Access文件(* .mdb)?通过使用我的意思是更改表,编写查询等。

Are there tools to convert it to another database format (mysql, postgresql or even gadfly)?

是否有工具将其转换为另一种数据库格式(mysql,postgresql甚至是gadfly)?

Also what problems may I encounter?

我还会遇到什么问题?

7 个解决方案

#1


14  

Although a bit dated, I've had good success with mdbtools which is a set of command line tools for accessing and converting Access databases to other formats. I've used it for importing databases into PostgreSQL.

虽然有点过时,但我在mdbtools上取得了很大成功,mdbtools是一组用于访问Access数据库并将其转换为其他格式的命令行工具。我用它将数据库导入PostgreSQL。

If you're running an Ubuntu variant you can install it with:

如果您正在运行Ubuntu变体,可以使用以下命令安装它:

sudo apt-get install mdbtools

or you can download it from here.

或者你可以从这里下载它。

#2


2  

I am currently trying Access with Wine on Ubuntu and I seem to be getting there. I have found that I need to copy various dlls manually, but that could easily be lack of reading up on the subject.

我目前正在尝试Ubuntu上的Access with Wine,我似乎已经到了那里。我发现我需要手动复制各种dll,但很容易缺乏对该主题的阅读。

#3


1  

From the documentation: Connecting To Microsoft Access. However, this seems to indicate that you need access running in a windows host and connect via ODBC... See also Known Problems.

从文档:连接到Microsoft Access。但是,这似乎表明您需要在Windows主机中运行并通过ODBC进行连接...另请参阅已知问题。

#4


1  

You're out of luck. Access has no real equivalent on Linux and while Kexi is an interesting alternative that can import Access files and aims to provide similar functionality, it doesn't actually uses Access files once the data is imported.

你运气不好。 Access在Linux上没有真正的等价物,而Kexi是一个有趣的替代品,可以导入Access文件并旨在提供类似的功能,它实际上不会导入数据导入文件。

If your assignment is to develop an Access application with forms etc as opposed to just using and mdb database as a store, then you can try a recent release of Wine with a compatible Access version (see compatibility list) or, even better, find a Windows machine where you're sure it's going to work.

如果您的任务是使用表单等开发Access应用程序而不是仅使用和mdb数据库作为存储,那么您可以尝试使用兼容的Access版本的最新版本的Wine(请参阅兼容性列表),或者更好的是,找到一个Windows机器,你确定它会工作。

Not to be forgotten, the use of a Virtual Machine loaded with Windows would help you achieve the same thing on your Linux box.

不要忘记,使用装有Windows的虚拟机可以帮助您在Linux机器上实现相同的功能。

#5


1  

If you've got an assignment to work with Access, then frigging find a Windows computer and do your exercise on the native platform for Access. It's completely senseless to do anything else, as you won't be learning anything useful about Access.

如果你有一个使用Access的任务,那么frigging找到一台Windows计算机并在本机平台上进行Access练习。做其他事情完全没有意义,因为你不会学习任何关于Access的有用信息。

If the assignment is to use a Jet data store, then that's something of a different story. And if it is, then you should have worded your question differently. I wouldn't recommend using Jet on anything but a native Windows file system. Certainly if the project is to actually read/write data to a Jet data file then you're not really fulfilling the assignment if you're not using Windows at least as the ODBC host.

如果分配是使用Jet数据存储,那么这是一个不同的故事。如果是,那么你应该以不同的方式表达你的问题。我建议不要在本机Windows文件系统上使用Jet。当然,如果项目是实际读取/写入数据到Jet数据文件,那么如果您至少不使用Windows作为ODBC主机,那么您实际上并没有完成任务。

#6


0  

You can work with Access through a connection (ODBC or OLEDB), as long as you only need to manage the "database" dimension of the file (tables and views, which are called "queries" in Access).

您可以通过连接(ODBC或OLEDB)使用Access,只要您只需要管理文件的“数据库”维度(表和视图,在Access中称为“查询”)。

Once the connection is open (see here for connection strings), you can send SQL commands to your mdb database, such as (where cn is here a connection object):

连接打开后(请参阅此处了解连接字符串),您可以将SQL命令发送到mdb数据库,例如(其中cn是连接对象):

cn.execute "CREATE TABLE myTableName (myTable_id autoNumber, myTable_code Text, ...)"

Please note that MsAccess uses a specific DDL that looks like the standard T-SQL but is not really it. Check the syntax in MsAccess help.

请注意,MsAccess使用看起来像标准T-SQL的特定DDL,但实际上并非如此。检查MsAccess帮助中的语法。

Depending on your database (and its constraints, default values, primary keys used, relations, data validation rules, aso), transfering Access can be easy and straight or might not even be possible. You will encounter a problem each time your database implement an access-specific/non-standard SQL rule.

根据您的数据库(及其约束,默认值,使用的主键,关系,数据验证规则,aso),转移Access可以是简单直接的,甚至可能是不可能的。每次数据库实现特定于访问的/非标准SQL规则时,您都会遇到问题。

If you really need to convert your access data to something else, I'd adise you to (1) export it under MS-SQL (the free version will be ok, an upsizing wizard is available in Access or on this site), (2)use an additional tool like this one to generate a "CREATE DATABASE" SQL Script, including or not data inserts, (3) use this script to try to create the database and its data on another database server.

如果您确实需要将访问数据转换为其他内容,我建议您(1)将其导出到MS-SQL下(免费版本可以,Access或本网站提供升迁向导),( 2)使用像这样的附加工具生成“CREATE DATABASE”SQL脚本,包括或不包含数据插入,(3)使用此脚本尝试在另一个数据库服务器上创建数据库及其数据。

#7


0  

Se my previous answer in a similar question. It's a litle script to do just that.

在类似问题中回答我之前的回答。这样做是一个小小的脚本。

Access DB5 to MySQL automatically

自动访问DB5到MySQL

#1


14  

Although a bit dated, I've had good success with mdbtools which is a set of command line tools for accessing and converting Access databases to other formats. I've used it for importing databases into PostgreSQL.

虽然有点过时,但我在mdbtools上取得了很大成功,mdbtools是一组用于访问Access数据库并将其转换为其他格式的命令行工具。我用它将数据库导入PostgreSQL。

If you're running an Ubuntu variant you can install it with:

如果您正在运行Ubuntu变体,可以使用以下命令安装它:

sudo apt-get install mdbtools

or you can download it from here.

或者你可以从这里下载它。

#2


2  

I am currently trying Access with Wine on Ubuntu and I seem to be getting there. I have found that I need to copy various dlls manually, but that could easily be lack of reading up on the subject.

我目前正在尝试Ubuntu上的Access with Wine,我似乎已经到了那里。我发现我需要手动复制各种dll,但很容易缺乏对该主题的阅读。

#3


1  

From the documentation: Connecting To Microsoft Access. However, this seems to indicate that you need access running in a windows host and connect via ODBC... See also Known Problems.

从文档:连接到Microsoft Access。但是,这似乎表明您需要在Windows主机中运行并通过ODBC进行连接...另请参阅已知问题。

#4


1  

You're out of luck. Access has no real equivalent on Linux and while Kexi is an interesting alternative that can import Access files and aims to provide similar functionality, it doesn't actually uses Access files once the data is imported.

你运气不好。 Access在Linux上没有真正的等价物,而Kexi是一个有趣的替代品,可以导入Access文件并旨在提供类似的功能,它实际上不会导入数据导入文件。

If your assignment is to develop an Access application with forms etc as opposed to just using and mdb database as a store, then you can try a recent release of Wine with a compatible Access version (see compatibility list) or, even better, find a Windows machine where you're sure it's going to work.

如果您的任务是使用表单等开发Access应用程序而不是仅使用和mdb数据库作为存储,那么您可以尝试使用兼容的Access版本的最新版本的Wine(请参阅兼容性列表),或者更好的是,找到一个Windows机器,你确定它会工作。

Not to be forgotten, the use of a Virtual Machine loaded with Windows would help you achieve the same thing on your Linux box.

不要忘记,使用装有Windows的虚拟机可以帮助您在Linux机器上实现相同的功能。

#5


1  

If you've got an assignment to work with Access, then frigging find a Windows computer and do your exercise on the native platform for Access. It's completely senseless to do anything else, as you won't be learning anything useful about Access.

如果你有一个使用Access的任务,那么frigging找到一台Windows计算机并在本机平台上进行Access练习。做其他事情完全没有意义,因为你不会学习任何关于Access的有用信息。

If the assignment is to use a Jet data store, then that's something of a different story. And if it is, then you should have worded your question differently. I wouldn't recommend using Jet on anything but a native Windows file system. Certainly if the project is to actually read/write data to a Jet data file then you're not really fulfilling the assignment if you're not using Windows at least as the ODBC host.

如果分配是使用Jet数据存储,那么这是一个不同的故事。如果是,那么你应该以不同的方式表达你的问题。我建议不要在本机Windows文件系统上使用Jet。当然,如果项目是实际读取/写入数据到Jet数据文件,那么如果您至少不使用Windows作为ODBC主机,那么您实际上并没有完成任务。

#6


0  

You can work with Access through a connection (ODBC or OLEDB), as long as you only need to manage the "database" dimension of the file (tables and views, which are called "queries" in Access).

您可以通过连接(ODBC或OLEDB)使用Access,只要您只需要管理文件的“数据库”维度(表和视图,在Access中称为“查询”)。

Once the connection is open (see here for connection strings), you can send SQL commands to your mdb database, such as (where cn is here a connection object):

连接打开后(请参阅此处了解连接字符串),您可以将SQL命令发送到mdb数据库,例如(其中cn是连接对象):

cn.execute "CREATE TABLE myTableName (myTable_id autoNumber, myTable_code Text, ...)"

Please note that MsAccess uses a specific DDL that looks like the standard T-SQL but is not really it. Check the syntax in MsAccess help.

请注意,MsAccess使用看起来像标准T-SQL的特定DDL,但实际上并非如此。检查MsAccess帮助中的语法。

Depending on your database (and its constraints, default values, primary keys used, relations, data validation rules, aso), transfering Access can be easy and straight or might not even be possible. You will encounter a problem each time your database implement an access-specific/non-standard SQL rule.

根据您的数据库(及其约束,默认值,使用的主键,关系,数据验证规则,aso),转移Access可以是简单直接的,甚至可能是不可能的。每次数据库实现特定于访问的/非标准SQL规则时,您都会遇到问题。

If you really need to convert your access data to something else, I'd adise you to (1) export it under MS-SQL (the free version will be ok, an upsizing wizard is available in Access or on this site), (2)use an additional tool like this one to generate a "CREATE DATABASE" SQL Script, including or not data inserts, (3) use this script to try to create the database and its data on another database server.

如果您确实需要将访问数据转换为其他内容,我建议您(1)将其导出到MS-SQL下(免费版本可以,Access或本网站提供升迁向导),( 2)使用像这样的附加工具生成“CREATE DATABASE”SQL脚本,包括或不包含数据插入,(3)使用此脚本尝试在另一个数据库服务器上创建数据库及其数据。

#7


0  

Se my previous answer in a similar question. It's a litle script to do just that.

在类似问题中回答我之前的回答。这样做是一个小小的脚本。

Access DB5 to MySQL automatically

自动访问DB5到MySQL