J2EE Basics: JDBC Driver Connections

JDBC Driver Connection Method list

There are many version of the Friends to find JDBC driver or the driver often ask how to use,In here I simply sort out driver with more typical usage.1. Microsoft SQL Server series (6.5, 7.x and 2000) and Sybase 10 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");

2. MySQLJDBC Name: Connector/J 3.0
URL: http://www.mysql.com/
Version: 3.0.8-stable
Download URL: http://www.mysql.com/downloads/api-jdbc-stable.html

Syntax:

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://host:port/database","user","password");

3. Oracle

JDBC Name: Connector/J 3.0
URL: http://otn.oracle.com/
Version: 3.0.8-stable
Download URL: http://otn.oracle.com/software/tech/java/sqlj_jdbc/content.html

Syntax:

Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@host:port:databse","user","password");

4. SybaseDriver: jConnect 4.5/5.5 (JDBC 2.0, use 5.5)

Syntax:

Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
Connection con = DriverManager.getConnection(
"jdbc: sybase: Tds: [IP address or machine name]: 2638? ServiceName = database name", "account", "password");

5. 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");

6. InformixDriver:com.informix.jdbc.IfxDriver Driver: com.informix.jdbc.IfxDriver

Syntax:

Class.forName("com.informix.jdbc.IfxDriver");
String full_db="jdbc:informix-sqli://10.14.86.11:300/authority:INFORMIXSERVER=ifx9;
user=informix;password=informix;NEWLOCALE=en_us,zh_tw;NEWCODESET=Big5,8859-1,819;";
String full_db = "jdbc:informix-sqli://10.14.86.11:300/authority:
INFORMIXSERVER=ifx9;user=informix;password=informix;NEWLOCALE=en_us,zh_tw;NEWCODESET=Big5,8859-1,819;";
con =DriverManager.getConnection(full_db);
con = DriverManager.getConnection (full_db);

7. IBM AS400 mainframe in the use of JDBC syntaxHave installed V4R4 or later of Client Access Express
Can be C:\Program Files\IBMClient Access\jt400lib
Find the driver files jt400.zip, and change the file name as 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");

List will be updated as we go ahead, don’t forget to check the updated one.

Leave a Reply

Your email address will not be published. Required fields are marked *