windows 自动访问 DB5 到 MySQL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/242975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Access DB5 to MySQL automatically
提问by Joshxtothe4
I have a problem, and was hoping I could rely on some of the experience here for advice and a push in the right direction. I have an MS Access file made by propietary software. I only want to take half the columns from this table, and import into new(not yet setup)mysql database.
我有一个问题,希望我可以依靠这里的一些经验来寻求建议并朝着正确的方向推动。我有一个由专有软件制作的 MS Access 文件。我只想从这个表中取出一半的列,并导入到新的(尚未设置)mysql 数据库中。
I have no idea how to do this or what the best way is. New data will be obtained each night, and again imported, as an automatic task.
我不知道如何做到这一点或最好的方法是什么。每天晚上都会获取新数据,然后作为自动任务再次导入。
One of the columns in the access database is a url to a jpeg file, I want to download this file and import into the database as a BLOB type automatically.
access 数据库中的一列是 jpeg 文件的 url,我想下载这个文件并自动作为 BLOB 类型导入到数据库中。
Is there a way to do this automatically? This will be on a windows machine, so perhaps it could be scripted with WSH?
有没有办法自动执行此操作?这将在 Windows 机器上,所以也许它可以用 WSH 编写脚本?
回答by Luis Melgratti
This is a bash script linuxexample using mdbtoolsfor automatic extraction and import from a mdb file to mysql.
这是一个 bash 脚本linux示例,使用mdbtools从 mdb 文件自动提取和导入到 mysql。
#!/bin/bash
MDBFILE="Data.mdb"
OPTIONS="-H -D %y-%m-%d"
mdb-export $OPTIONS $MDBFILE TableName_1 > output_1.txt
mdb-export $OPTIONS $MDBFILE TableName_2 > output_2.txt
mdb-export $OPTIONS $MDBFILE TableName_n > output_n.txt
MYSQLOPTIONS=' --fields-optionally-enclosed-by=" --fields-terminated-by=, -r '
mysqlimport $MYSQLOPTIONS -L -uuser -ppasword database output_1.txt
mysqlimport $MYSQLOPTIONS -L -uuser -ppasword database output_2.txt
mysqlimport $MYSQLOPTIONS -L -uuser -ppasword database output_n.txt
You can use some others mysqlimport options: --delete: to delete previous Data from the target mysql table. --ignore: ignore duplicates --replace: replace if a duplicate is found
您可以使用其他一些 mysqlimport 选项:--delete:从目标 mysql 表中删除以前的数据。--ignore: 忽略重复项 --replace: 如果找到重复项则替换
It's not a windows solution but i Hope it helps.
这不是 Windows 解决方案,但我希望它有所帮助。
回答by Daniel Kreiseder
http://www.dbtalk.net/mailing-database-mysql-win32/what-quickest-way-convert-access-136837.html
http://www.dbtalk.net/mailing-database-mysql-win32/what-quickest-way-convert-access-136837.html
Search for Kofler (He wrote a german Book, where Part of it was a mdb2sql converter)
搜索 Kofler(他写了一本德语书,其中一部分是 mdb2sql 转换器)
Here is a newer edition. http://www.amazon.de/Definitive-Guide-MySQL/dp/1590595351/ref=sr_1_3?ie=UTF8&s=books-intl-de&qid=1225197012&sr=8-3