Common database connection URL address Daquan

Source: Internet
Author: User
Tags db2 ibm db2 informix microsoft sql server odbc postgresql sybase sybase database

1. oracle8/8i/9i database (thin mode)

Class.forName ("Oracle.jdbc.driver.OracleDriver"). newinstance ();
String url= "Jdbc:oracle:thin: @localhost: 1521:ORCL";
ORCL the SID for the database
String user= "Test";
String password= "Test";
Connection conn= drivermanager.getconnection (Url,user,password);

2. DB2 Database

Class.forName ("Com.ibm.db2.jdbc.app.DB2Driver"). newinstance ();
String url= "Jdbc:db2://localhost:5000/sample";
Sample is your database name
String user= "admin";
String password= "";
Connection conn= drivermanager.getconnection (Url,user,password);

3. SQL server7.0/2000 Database

Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver"). newinstance ();
String url= "Jdbc:microsoft:sqlserver://localhost:1433;databasename=mydb";
MyDB for the database
String user= "SA";
String password= "";
Connection conn= drivermanager.getconnection (Url,user,password);

4. Sybase database

Class.forName ("Com.sybase.jdbc.SybDriver"). newinstance ();
String url = "Jdbc:sybase:tds:localhost:5007/mydb";
MyDB for your database name
Properties sysprops = System.getproperties ();
Sysprops.put ("User", "userid");
Sysprops.put ("Password", "User_password");
Connection conn= drivermanager.getconnection (URL, sysprops);

5. Informix Database

Class.forName ("Com.informix.jdbc.IfxDriver"). newinstance ();
String url = "Jdbc:informix-sqli://123.45.67.89:1533/mydb:informixserver=myserver;

User=testuser;password=testpassword "; MyDB for Database name
Connection conn= drivermanager.getconnection (URL);

6. mysql Database

Class.forName ("Org.gjt.mm.mysql.Driver"). Newinstance ();&
Class.forName ("Com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost/mydb?user=soft&password=soft1234&useunicode=true& Characterencoding=8859_1 "
MyDB for Database name
Connection conn= drivermanager.getconnection (URL);

7. PostgreSQL Database

Class.forName ("Org.postgresql.Driver"). newinstance ();
String url = "Jdbc:postgresql://localhost/mydb"
MyDB for Database name
String user= "MyUser";
String password= "MyPassword";
Connection conn= drivermanager.getconnection (Url,user,password);

8, Access database directly with ODBC

Class.forName ("Sun.jdbc.odbc.JdbcOdbcDriver");
String url= "Jdbc:odbc:driver={microsoft Access Driver (*.mdb)};
Dbq= "+application.getrealpath ("/data/reportdemo.mdb ");
Connection conn = drivermanager.getconnection (URL, "", "");
Statement stmtnew=conn.createstatement ();

Another kind

Microsoft SQL Server Microsoft SQL Server Driver package Name:Msbase.jar Mssqlserver.jar Msutil.jar
Driver class Name: com.microsoft. JDBC JDBC:microsoft:sqlserver://<server_name>:<port>
Default port 1433, port can be omitted if the server uses the default port

Microsoft SQL Server 2005 Driver package name:Sqljdbc.jar
Driver class Name: com.microsoft.sqlserver. JDBC JDBC:sqlserver://<server_name>:<port>
Default port 1433, port can be omitted if the server uses the default port


Oracleoracle Thin Driver package name:Ojdbc14.jar
Driver class Name: Oracle. JDBC URL:
jdbc: oracle:thin:@//Or
jdbc:oracle:thin:@


IBM db2ibm DB2 Universal Driver Type 4

Driver package Name:Db2jcc.jar Db2jcc_license_cu.jar
Driver class Name: com.ibm.db2.jcc.DB2Driver
URL: Database_name>

IBM DB2 Universal Driver Type 2

Driver package Name:Db2jcc.jar Db2jcc_license_cu.jar
Driver class Name: com.ibm.db2.jcc.DB2Driver
URL: database_name>


Mysqlmysql connector/j Driver

Driver package Name:Mysql-connector-java-x.x.xx-bin.jar
Driver class Name: com.mysql. JDBC jdbc:mysql://database
_name>
Default Port 3306, port can be omitted if the server uses the default port
MySQL connector/j Driver allowed in jdbc:mysql://database_name>? Property1=value1&property2=value2


Informix Informix driver package name:Ifxjdbc.jar
Driver class Name: com.informix. JDBC jdbc: informix-sqli://{<ip-address>|


SybaseSybase Adaptive Server Enterprise driver package Name:Jconn2.jar or Jconn3.jar
Driver class Name: com.sybase. jdbc. Sybdriver (com.sybase. JDBC. Sybdriver)
URL: JDBC:sybase:tds:

Sybase Adaptive Server Anywhere or Sybase IQ driver package Name:Jconn2.jar or Jconn3.jar
Driver class Name: com.sybase. jdbc. Sybdriver (com.sybase. JDBC. Sybdriver)
URL: database_name>
Default Port 2638


PostgreSQLPostgreSQL Native Driver Package Name: Driver class Name: org.postgresql.Driver
URL: database_name>
Default Port 5432


Teradatateradata Driver for the Driver package name:Terajdbc4.jar Tdgssjava.jar Gui.jar
Driver class Name: com.ncr.teradata.TeraDriver
URL:
Type 4: jdbc: teradata://gatewayservername:portnumber
/databaseservername/param1,param2,...


Netezzanetezza Driver package name:Terajdbc4.jar Tdgssjava.jar Gui.jar
Driver class Name: org.netezza.Driver
URL: Database_name>

Common database connection URL address Daquan

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.