CYQ. DBImport database reverse engineering and batch import database tool V1.0 released

Source: Internet
Author: User

[Tip:Fixed some bugs and then re-uploaded them. The previous download was a new one.]

 

Miscellaneous:

After purchasing VPS, I plan to migrate the QBlog of the autumn garden and change the current Access database to another database.

Because the VPS only has 300 MB of memory, the installation of the system is faster than MB, it is too difficult to run MSSQL2005, so it will not be installed.

MySql is installed by default, so I plan to run it in MySql.

 

QBlogIt was used in the first place.CYQ. DataThe multi-database parsing tag can parse the differentiated code or functions of each database.

Therefore, database replacement is almost zero cost, and the Code does not need to be changed,The only thing you need to think about is how to generate the MySql table structure and export data.

 

Naturally, the first response is to search for "Access to guide data to MySql" on the Internet:

1: It's hard to get a new one. After installation, the default webpage with plug-in navigation is provided. You can only say "RI" and unload it immediately. You have to manually delete the plug-in file.

2: After that, I found a small tool that seemed to be capable of directing. After a few pieces of data were imported, I did not respond. As a result, it was a Demo version, which became even more difficult.

3: After that, I found "Navicat for MySQL" and used it to export data. More than 30 thousand articles were lost to me, so it was very difficult.

But there is a benefit, that is, to help generate the table structure. Unfortunately, this table structure is not real, and we can only make up for it. The data type is not correct, and we have to make a big change on our own:

After the original Bit is generated and changed to another type, MySql is also changed to Bit. It is found that data cannot be imported because Access is true/false and MySql is 1/0, the Data Length too long is lost in this article. This type is asymmetrical and the Tangle is somewhat depressing.

4: I asked my colleagues if they had any good tools. My colleagues said, you should write your own code. If you don't fold it, you decide to write your own code.

 

The MDataTable of CYQ. Data has implemented the batch insertion [without auto-increment ID] and batch update functions [On-Demand update].

 

Think about it, extend it, and add the insert with ID, it becomes the batch data import function:

So I started busy coding, testing, and switching between databases. After a few days, I was stuck with some problems, such as the character set of MySQL, however, we can see the results at the end.

After the batch import function is implemented, a DOS version tool is written to import the entire database data from Access to MySQL in batches.

After that, the autumn garden ran around MySQL and encountered a lot of MySql problems. For example, it was a query of dozens or dozens of seconds, which was too abnormal. After launching a mass test:

It is found that the default configuration is incorrect. You need to configure the memory. After modifying my. ini to increase the memory, the speed is also normal.

Unfortunately, the VPS memory is not much, and MySql cannot afford it, so we had to stop it, so we ran a lap of data export to SQLite, Oracle, and Sql2000.

After some function Parsing is corrected, all functions run normally. SQLite finds that the speed is no different from the Access speed. Oracle requires an index to increase the speed.

Currently: The sample version of autumn Garden: http://demo.cyqdata.com/run in Sql2000 database.

However, the autumn garden is still running in the Access database version.

 

At this time,CYQ. DataThe MDataTable already has a data import and export tool, which should be very powerful.

 

Then a few days later, it seems that "Domain-driven" is quite popular, and then another idea is generated:

Make CYQ. data is also "driven". If the Columns Column Structure of the MDataTable is used, the table structure of different databases can be reverse generated, so CYQ is used. during Data development, you can achieve "Code First" without having to prioritize database issues.

Then, the database is re-transferred to optimize the code, data type conversion, testing, generation, example, code, modification, and testing, it took another few days and finally completed, CYQ. the powerful reverse engineering function of Data has also been completed.

 

It took me one night to writeCYQ. DBImportIt took another day to debug the code and finally got the following content:

 

Main functions:

 

1: Database reverse engineering function

Other database scripts can be generated from any database supported by CYQ. Data.

Currently supported databases: Access, Sql2000/2005/2008, Oracle, MySql, and Sqlite.

 

2: Batch Data Import

Data can be directed to another database from any database.

Because it has the function of generating other database scripts in reverse direction, it will automatically detect whether a specified table exists:

If the table does not exist, the table is automatically created;

If the table exists, data is imported directly.

 

Interface and usage:

 

1: Double-click to run the task. For details, see the main interface.

Note:

1: DBConnection From: the database From which data is exported.

2: DBConnection To: database To which data is directed.

 

2: Enter the database link of DBConnection From and click Connect.

Note:

ReadMe: There are Demo examples of various database links, so you don't have to worry about writing them.

Tables: database table

(Un) Check All: Select All and invert tables.

 

3: [optional steps] Select ViewDBSql to view the reverse generated table script. If you are not satisfied, you can modify the script by yourself.

 

A: generate the Access table structure from the Blog_File table of Mssql

 

B: generate the MySql table structure from the Blog_Visit table of Mssql

Note:

1: Click the table on the left and right, and then select DalType on the right to generate different table structures.

2: Execute DBSql: Any SQL statement can be executed, which is unavailable by default. Fill in the Link string of DBConnection,

Click Connect to return to the available status.

 

4: Enter the database link of DBConnection To, and click the link: Connect

Note:

After the connection is successful: Execute DBSqlAnd Import Go [Import Data]Restore availability.

 

5: select the table for data Import, select [Import By Pager] as needed, and click "Import Go" to start data Import.

Note:

1: Import By Page: it refers to querying and exporting data By Page. If the data volume is large, it is best to use this method. Otherwise, when all data is read at a time and then inserted, read data stops.

2: according to the instructions, when importing data by page, if the connection of DBConnection From is Mssql/Oracle database, CYQ is required. the corresponding paging storage process of Data can be found on the website prompted above. It has just been released and is available in both autumn and blog gardens.

 

6: The batch import of the database is complete. The prompt is displayed.

 

Summary:

This tool is based on the CYQ. Data framework. Welcome to use and pay attention to CYQ. Data.

 

CYQ. DBImport :Http://www.cyqdata.com/download/article-detail-426

 

Add a few other statements:

1: Do not ask the source code. It will be released at the time of release.

2: Open Source! = Free. If you are not clear about it, you should first go online to view the relevant information. Of course, it is not necessarily charged if you do not have open source.

3: when requesting the source code, ask yourself, what have you contributed? Don't just ask for it. People should not owe you anything in their previous lives, and you need to pursue or abuse your troubles in this life.

 

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.