JDBC database connection Overview

Source: Internet
Author: User
Tags sybase
1. "com. Microsoft. JDBC. sqlserver. sqlserverdriver" is equivalent to the jar package of the driver, because the connection method you use is JDBC. If you use ODBC-jdbc bridge, you do not need to use this jar package.
Port 2.1433 is the port listened upon after SQL Server is started. It is used for external programs to interact with SQL Server databases.

1. MySQL (http://www.mysql.com) Mm. mysql-2.0.2-bin.jar
Class. forname ("org. gjt. Mm. MySQL. Driver ");
CN = drivermanager. getconnection ("JDBC: mysql: // mydbcomputernameorip: 3306/mydatabasename", susr, spwd );

2. PostgreSQL (http://www.de.postgresql.org) pgjdbc2.jar
Class. forname ("org. PostgreSQL. Driver ");
CN = drivermanager. getconnection ("JDBC: PostgreSQL: // mydbcomputernameorip/mydatabasename", susr, spwd );

3. Oracle (http://www.oracle.com/ip/deploy/database/oracle9i/ connector classes12.zip
Class. forname ("oracle. JDBC. Driver. oracledriver ");
CN = drivermanager. getconnection ("JDBC: oracle: thin: @ mydbcomputernameorip: 1521: orcl", susr, spwd );

4. Sybase (http://jtds.sourceforge.net) jconn2.jar
Class. forname ("com. Sybase. jdbc2.jdbc. sybdriver ");
CN = drivermanager. getconnection ("JDBC: Sybase: TDS: mydbcomputernameorip: 2638", susr, spwd );
// (Default-username/password: "dba"/"SQL") (http://sourceforge.net/forum/forum.php? Forum_id = 509725)

5. Microsoft sqlserver (http://jtds.sourceforge.net)
Class. forname ("net. SourceForge. jtds. JDBC. Driver ");
CN = drivermanager. getconnection ("JDBC: jtds: sqlserver: // mydbcomputernameorip: 1433/master", susr, spwd );

6. Microsoft sqlserver (http://www.microsoft.com)
Class. forname ("com. Microsoft. JDBC. sqlserver. sqlserverdriver ");
CN = drivermanager. getconnection ("JDBC: Microsoft: sqlserver: // mydbcomputernameorip: 1433; databasename = Master", susr, spwd );

7. ODBC
Class. forname ("Sun. JDBC. ODBC. jdbcodbcdriver ");
Connection Cn = drivermanager. getconnection ("JDBC: ODBC:" + sdsn, susr, spwd );

8. DB2
Class. forname ("com.ibm.db2.jdbc.net. db2driver ");
String url = "JDBC: DB2: // 192.9.200.108: 6789/sample"
CN = drivermanager. getconnection (URL, susr, spwd );

 

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.