MENU service case
 Website construction website design Beijing website construction high-end website production company Shangpin China
We create by embracing change
360 ° brand value__
simplified Chinese character
Simplified Chinese English

Shangpin China Joins Hands with Beisheng Internet to Create a New Chapter in Website Construction

Type: Shangpin Dynamic Learn more

Tutorial of website data migration from ORACLE to MYSQL

Source: Shangpin China | Type: website encyclopedia | Time: May 24, 2012
Website production (www.sino web. net). In order to reduce the operation cost of the website, we should consider changing the database from the original enterprise database ORACLE to a smaller MYSQL. An important process in the database change is the data migration of the website. In the process of data migration, I encountered some problems and took a long time to solve them. Today, I will analyze and summarize the problems that need attention in the background database construction of the website.

1. Different databases have different definitions of individual data types

In the process of testing database changes, we found that there was a problem with the publication time displayed on the previous article details page of the website, which was in an abnormal format of year month day hour minute.

After checking the file code and database records retrieved from the page, it is found that there is only one definition type of time in ORACLE, and the format of this definition type includes year, month, day and time; In MYSQL, the definition types of time include Date, Time and Datetime. In MYSQL, the definition of Date type only includes the year, month and day, not the time.

To solve this problem, you can only change the field type created in the MYSQL database table from the original Date to Datetime, and then import this type of data again.

Summary: Different databases have different definitions of specific types. Therefore, after completing the structural components of the new database table, it is better to migrate a small number of data record bars for data testing, so that the problem can be found in time, the data type can be modified, and then all data can be migrated, so as to avoid repeated data import and increased workload.

2. Different databases have different case sensitivity

During the database migration test, it is found that the articles added through the website background management system are abnormal, and error messages will appear. It was found that the record bar corresponding to the new article could not be inserted normally by calling the record of the article SiteArticle table in the database.

Through code test and inspection, it is found that the inconsistency between the case and case of the table name of the web page file code and the database operation is the cause. ORACLE database has a good tolerance and supports the insertion of new records of the web page file about the insert into Sitearticle () code to the SiteArticle table; The MYSQL database is case sensitive and only supports the insert into SiteArticle() code to insert new records into the SiteArticle table.

To solve this problem, you can only view the source code of the web page file carefully, change the case of the characters of the database name, table name, field name, etc. of all statements operating on the database, and keep the case consistent with the case of the name created in the database.

Summary: From the perspective of compatibility, the case problem in the code related to database operation should be standardized during website construction. In the process of replacing or upgrading the database in the future, case sensitivity should not be concerned, and the workload of changing code should be reduced.

3. Different databases have different requirements for reserved words

In the process of database migration, it was found that after the case was unified, the record insertion of the keyword tag still failed when the article was submitted, and the error message was prompted as a syntax error.

After investigation, it was found that reserved characters were playing tricks. In ORACLE database, the attitude towards reserved words is relatively tolerant, and reserved words can be used for table names and field names; The MYSQL database stipulates that reserved words cannot be used as table names and field names. One of the fields in the Sitearticle table of the website database is called show, which is a reserved word. Therefore, it is also established in the MYSQL database, and a syntax error is inserted in the new record.

To solve this problem, you need to use the '' symbol (that is, the symbol entered by the key in front of the 1 key) to distinguish the show field name of the Sitearticle table in the code statement in the web page code.

Summary: Different databases have different requirements for reserved words, so no matter whether the current database type version supports it or not, reserved words should not be used as field names and table names as far as possible during the construction of the website database to ensure normal operation after the upgrade and replacement of later database versions.
This article was published by Beijing website production company Shangpin China //ihucc.com/
Source Statement: This article is original or edited by Shangpin China's editors. If it needs to be reproduced, please indicate that it is from Shangpin China. The above contents (including pictures and words) are from the Internet. If there is any infringement, please contact us in time (010-60259772).
TAG label:

What if your website can increase the number of conversions and improve customer satisfaction?

Make an appointment with a professional consultant to communicate!

* Shangpin professional consultant will contact you as soon as possible

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]

Communicate with professional consultants now!

  • National Service Hotline

    400-700-4979

  • Beijing Service Hotline

    010-60259772

Please be assured to fill in the information protection
Online consultation

Disclaimer

Thank you very much for visiting our website. Please read all the terms of this statement carefully before you use this website.

1. Part of the content of this site comes from the network, and the copyright of some articles and pictures involved belongs to the original author. The reprint of this site is for everyone to learn and exchange, and should not be used for any commercial activities.

2. This website does not assume any form of loss or injury caused by users to themselves and others due to the use of these resources.

3. For issues not covered in this statement, please refer to relevant national laws and regulations. In case of conflict between this statement and national laws and regulations, the national laws and regulations shall prevail.

4. If it infringes your legitimate rights and interests, please contact us in time, and we will delete the relevant content at the first time!

Contact: 010-60259772
E-mail: [email protected]