How MySQL, Oracle, and SQL Server database JDBC are connected

Source: Internet
Author: User
Tags sql server driver

How to connect MySQL, Oracle, SQL Server database JDBC mysql:                  add a MySQL jar package first                   String url= "jdbc:mysql://localhost:3306/database name";       //Database address                  String name= "root";      //database user name                   String password= "123456";      // Database user Password                  Class.forName ("Com.mysql.jdbc.Driver");     //load MySQL driver                   Connection conn = Drivermanager.getconnection ( Url,name,passWOrd);      //Connection Database  Oracle:                 Add Oracle's JAR package                  String url= "Jdbc:oracle:thin: @localhost: 1521: Database Name";      //Database address                 String name= "Database user name";      //database user name                  String password= "database user password";      / /database user Password                 Class.forName ("Oracle.jdbc.driver.OracleDriver");      //load Oracle Drive                  Connection conn = Drivermanager.getconnection (URL,Name,password);      //Connection Database  sql server:                      Add a jar package for SQL Server                        String url= "jdbc:sqlserver://localhost:1433;databasename= database name";      // Database Address                       sring name= "Database username";      //database user name                       String Password = "Database user password";      //database user password                       Class.forName (" Com.microsoft.sqlserver.jdbc.SQLServerDriveR ");      //Load SQL Server driver                       Connection conn = Drivermanager.getconnection ( Url,name,password);      //Connection database  

How to connect MySQL, Oracle, SQL Server database JDBC

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.