Data migration of relational database in different relational database

Source: Internet
Author: User
Tags odbc stmt

Scenario 1: Export the database file-Import
Scenario 2:navicat prrmium Data transfer
Good effect between the same database software, there are some problems between different database software
Scenario 3: Write the program, connect the old database, take out the data, connect to the new database, and deposit the data

class.forname ("Oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@" +servername+ ": 1521:eclipsedb";  Connection connoracle = drivermanager.getconnection (URL, "Eclipse", "888888"); Connect source data source Statement stmt = Connoracle.createstatement (); ResultSet rs = stmt.executequery ("SELECT * from employee");    Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");  Connection connaccess = drivermanager.getconnection ("Jdbc:odbc:target", "", "" "); Connecting the target data source PreparedStatement pstmt = connaccess.preparestatement ("INSERT into employee (id,name,department,salary) VALUES (?,?,?,?) ");    /cyclic loading data while (Rs.next ()) {Pstmt.setint (1,rs.getint ("id"));    Pstmt.setstring (2,rs.getstring ("name"));        Pstmt.setstring (3,rs.getstring ("department"));        Pstmt.setdouble (4,rs.getdouble ("salary")); Pstmt.executeupdate ();} Release resources Rs.close (); Stmt.close ();p stmt.close (); Connoracle.close (); Connaccess.close ();  

From http://zhengshuo3527.blog.163.com/blog/static/615348220073381530569/

Data migration of relational database in different relational 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.