Quick Migration of ACCESS database to MySQL

Source: Internet
Author: User
Tags odbc php and php source code table name access database
Recently, I want to develop an information management system for the company from the development machine (Windows NT IIS4.0 Access) migrating to a real Linux server (Apache1.3.12 PHP 4.03 MySQL 3.23.26), the migration of content from dozens of tables in the database started to tip me for some twists and turns, some MySqL customer software or database management software have been downloaded from the internet. Well-written software has data migration functions, but there are two migration methods, one is to use the file import method. This method produces errors when processing characters with the same separator in the database, especially when processing Memo fields in ACCESS, which are prone to errors, in the end, the exported data is either too much or less. However, another feature that supports direct ODBC import is quite powerful, and the content of each table can be imported without errors, but unfortunately, this must be because the field in the table created in ACCESS is in English. For example, if the field in ACCESS is a Chinese name, an error occurs and cannot be imported successfully.
For this reason, I had to spend some time writing two small programs to migrate the ACCESS database content to MySQL. After use, the results are not bad. I would like to write here for you to try or judge.
First, we will outline how to use it,
1. Create a "system DSN" for the ACCESS database ";
2. Create an empty table in MySQL based on the name of each table in the ACCESS database;
3. Run fdlist. php;
4. Run import. php;
5. You can migrate a table in step 3 and step 4 each time. Then, modify the ACCESS Source table name in fdlist. php and the target table name in MySQL, and then run Step 3 and step 3 until all tables are migrated,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
The fdlist. php source code is as follows:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
<Html>
<Head>
<Style type = text/css>
Body, td, li, div, p, pre, a, B, h1, h2, h3, h4 {font-family: verdana; font-size: 9pt; line-height: 18px; color: # a00000}
</Style>
</Head>
<?
$ Dbconnection = @ mysql_connect ("yourmysqlserver", "mysqlaccount", "mysqlpassword ")

Or die ("can not connect to database server ");

@ Mysql_select_db ("yourdatabase ")

Or die ("<p style = 'font-size: 9pt; font-family: verdana; color: #803333; font-weight: bold '> No Database, </p> ");
$ Odbc_table = "youroriginaltable"; // The original table name in your ODBC database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.