) JDBC driver download and connection string URL writing

Source: Internet
Author: User
Tags informix interbase sybase support microsoft

JDBC driver list on Sun Official Website:Http://java.sun.com/products/jdbc/reference/industrysupport/index.html

Data Base Description
MySQL Http://www.mysql.com/products/connector/j/Shipped. but need to download the latest for MySQL 4.1 or higher.
Oracle Http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/index.htmlEncoded ded.
SQL Server by jtds Http://sourceforge.net/project/showfiles.php? Group_id = 33291Supported ded. Support Microsoft SQL Server (6.5, 7, 2000 and 2005)
Postgres Http://jdbc.postgresql.org/download.htmlSupported ded 7.3 JDBC 3
SAP DB Http://www.sapdb.org/sap_db_jdbc.htmEncoded ded.
Sybase by jtds Http://jtds.sourceforge.net/Supported ded. Support Sybase (10, 11, 12)

The following content is from the Internet

1. MySQL ( Http://www.mysql.com ) Mysql-connector-java-2.0.14-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/ ) 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 ")
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 );
9. Because access does not run as a service, the URL method is not applicable to access. Access can be found in the form of ODBC or server ing paths. For more information, see Http://rmijdbc.objectweb.org/Access/access.html How to Use JDBC APIs
(1) Register and load the JDBC driver Program ;
Two methods:
Class. forname (string drivername );
Drivermanager. registerdriver (driver Driver) (2) establish a connection with the SQL database;
The getconnection () method of drivermanager:
Connection getconnection (string URL): URL indicates the database address string;
Connection getconnection (string URL, string user, string PWD)
Connection getconnection (string URL, properties info)
(3) Send an SQL query;
The createstatement () method of connection:
Statement createstatement ();
Statement can execute SQL statements to obtain SQL query results. (4) obtain the result set.
Statement:
Resultset executequery (string SQL): Execute the SELECT statement.
Int executeupdate (string SQL): Execute update statements, such as insert, delete, update. (5) to search query results.
Resultset method:
Boolean next (): returns false if no rows exist;
String getstring (string columnname): returns the value of the column name.

Bytes --------------------------------------------------------------------------------------------
For your convenience, the content is as follows:
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 ")

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 (new)
Class. forname ("com.ibm.db2.jdbc.net. db2driver ");
String url = "JDBC: DB2: // 192.9.200.108: 6789/sample"
CN = drivermanager. getconnection (URL, susr, spwd );

9. Microsoft SQL Server Series (6.5, 7.x and 2000) and Sybase 10

JDBC name: jtds
URL: http://jtds.sourceforge.net/
Version: 0.5.1
Download URL: http://sourceforge.net/project/showfiles.php? Group_id = 33291

Syntax:
Class. forname ("net. SourceForge. jtds. JDBC. Driver ");
Connection con = drivermanager. getconnection ("JDBC: jtds: sqlserver: // host: Port/Database", "user", "password ");
Or
Connection con = drivermanager. getconnection ("JDBC: jtds: Sybase: // host: Port/Database", "user", "password ");

10. PostgreSQL
JDBC name: PostgreSQL JDBC
URL: http://jdbc.postgresql.org/
Version: 7.3.3 build 110
Download URL: http://jdbc.postgresql.org/download.html
Syntax:
Class. forname ("org. PostgreSQL. Driver ");
Connection con = drivermanager. getconnection ("JDBC: PostgreSQL: // host: Port/Database", "user", "password ");

11. JDBC syntax used by the IBM as400 host
Client Access express with v4r4 or later versions
You can go to c: \ Program Files \ IBM \ Client Access \ jt400 \ Lib
Locate the driver file jt400.zip and change the file extension to jt400.jar.
Syntax:
Java. SQL. drivermanager. registerdriver (new COM. IBM. as400.access. as400jdbcdriver ());
Class. forname ("com. IBM. as400.access. as400jdbcconnection ");
Con = drivermanager. getconnection ("JDBC: as400: // ip", "user", "password ");

12. Informix
Class. forname ("com. Informix. JDBC. ifxdriver"). newinstance ();
String url =
"JDBC: Informix-sqli: // 123.45.67.89: 1533/testdb: informixserver = myserver;
User = testuser; Password = testpassword ";
Lib: jdbcdrv.zip <br> class. forname ("com. Sybase. JDBC. sybdriver ")
Url = "JDBC: Sybase: TDS: FIG: 2638/asademo ";
Sybconnection connection = (sybconnection) drivermanager. getconnection (URL, "dba", "SQL ");

13. SAP DB
Class. forname ("com. sap. dbtech. JDBC. driversapdb ");
Java. SQL. Connection connection = java. SQL. drivermanager. getconnection ("JDBC: sapdb: //" + host + "/" + database_name, user_name, password)

14. InterBase
String url = "JDBC: Interbase: // localhost/E:/testbed/database/employee. GDB ";
Class. forname ("InterBase. interclient. Driver ");
// Driver d = new InterBase. interclient. Driver ();/* This will also work if you do not want the line above */
Connection conn = drivermanager. getconnection (URL, "sysdba", "masterkey ");

15. HSQLDB
URL: http://hsqldb.sourceforge.net/
Driver: org. HSQLDB. jdbcdriver
There are four connection methods:
Con-STR (memory): JDBC: HSQLDB.
Con-STR (local): JDBC: HSQLDB:/path/to/The/DB/Dir
Con-STR (HTTP): JDBC: HSQLDB: http: // dbsrv
Con-STR (hsql): JDBC: HSQLDB: hsql: // dbsrv

Reference: http://www.blogjava.net/simie/archive/2007/07/01/127366.html

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.