0% found this document useful (0 votes)
736 views

JDBC Drivers and Connection Strings

This document provides information on JDBC drivers and connection strings for connecting to popular database products like MySQL, Oracle, IBM DB2, Microsoft SQL Server from Java applications. It lists the driver class and sample connection URL formats for each database. It also provides a table with a more extensive list of JDBC drivers for other databases along with the driver class and connection URL syntax for each.

Uploaded by

api-3804031
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
736 views

JDBC Drivers and Connection Strings

This document provides information on JDBC drivers and connection strings for connecting to popular database products like MySQL, Oracle, IBM DB2, Microsoft SQL Server from Java applications. It lists the driver class and sample connection URL formats for each database. It also provides a table with a more extensive list of JDBC drivers for other databases along with the driver class and connection URL syntax for each.

Uploaded by

api-3804031
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 4

Database Drivers and Connection Strings for various popular Database products:

MySQL:

Driver : "org.gjt.mm.mysql.Driver" and "com.mysql.jdbc.Driver"


Connection String : "jdbc:mysql://Server_name:Port_number/Database_name?
user=user_name&password=password_string"
Server_name :
Default: localhost
Other ex: www.yourDomain.com, www.abc.com
Port_number :
default : 3306(you know it by running "MySQLInstanceConfig.exe" utility)
Database_name :
Name of the database to which you want to connect

Oracle:

Driver : "oracle.jdbc.driver.OracleDriver"
Connection String : "jdbc:oracle:thin@Server_name:Port_number/Database_name"
Server_name :
Default : localhost,
Other ex: www.yourDomain.com, www.abc.com
Port_number :
default : 1521
Database_name :
Name of the database to which you want to connect

IBM's DB2:

Driver : Type 2 Driver ---> "COM.ibm.db2.jdbc.app.DB2Driver" and


Type 4 Driver(Net driver) ---> "com.ibm.db2.jcc.DB2Driver"
Connection String : Type 2 ---> "jdbc:db2:Database_name"
Type 4 ---> "jdbc:db2://Server_name:Port_number/Database_name"
Server_name :
Default: localhost
Other ex: www.yourDomain.com, www.abc.com
Port_number :
default : 50000 (you know at the time of db2 installation, it prompts you for a port number)
Database_name :
Name of the database to which you want to connect

MicroSoft's SQLServer:

Driver : "com.jnetdirect.jsql.JSQLDriver"
Connection String : "jdbc:JSQLConnect://Server_name:Port_number/Database_name"
Server_name :
Default: localhost
Other ex: www.yourDomain.com, www.abc.com
Port_number :
default : 1433
Database_name :
Name of the database to which you want to connect

A List of JDBC Drivers


If you need to access a database with Java, you need a driver. This is a list of the drivers
available, what database they can access, who makes it, and how to contact them.

IBM DB2
jdbc:db2://<HOST>:<PORT>/<DB>
COM.ibm.db2.jdbc.app.DB2Driver <-- Type 2
com.ibm.db2.jcc.DB2Driver <-- Type 4

JDBC-ODBC Bridge
jdbc:odbc:<DB>
sun.jdbc.odbc.JdbcOdbcDriver

Microsoft SQL Server


jdbc:weblogic:mssqlserver4:<DB>@<HOST>:<PORT>
weblogic.jdbc.mssqlserver4.Driver

Oracle Thin
jdbc:oracle:thin:@<HOST>:<PORT>:<SID>
oracle.jdbc.driver.OracleDriver

PointBase Embedded Server


jdbc:pointbase://embedded[:<PORT>]/<DB>
com.pointbase.jdbc.jdbcUniversalDriver

Cloudscape
jdbc:cloudscape:<DB>
COM.cloudscape.core.JDBCDriver

Cloudscape RMI
jdbc:rmi://<HOST>:<PORT>/jdbc:cloudscape:<DB>
RmiJdbc.RJDriver

Firebird (JCA/JDBC Driver)


jdbc:firebirdsql:[//<HOST>[:<PORT>]/]<DB>
org.firebirdsql.jdbc.FBDriver

IDS Server
jdbc:ids://<HOST>:<PORT>/conn?dsn='<ODBC_DSN_NAME>'
ids.sql.IDSDriver
Informix Dynamic Server
jdbc:informix-sqli://<HOST>:<PORT>/<DB>:INFORMIXSERVER=<SERVER_NAME>
com.informix.jdbc.IfxDriver

InstantDB (v3.13 and earlier)


jdbc:idb:<DB>
jdbc.idbDriver

InstantDB (v3.14 and later)


jdbc:idb:<DB>
org.enhydra.instantdb.jdbc.idbDriver

Interbase (InterClient Driver)


jdbc:interbase://<HOST>/<DB>
interbase.interclient.Driver

Hypersonic SQL (v1.2 and earlier)


jdbc:HypersonicSQL:<DB>
hSql.hDriver

Hypersonic SQL (v1.3 and later)


jdbc:HypersonicSQL:<DB>
org.hsql.jdbcDriver

Microsoft SQL Server (JTurbo Driver)


jdbc:JTurbo://<HOST>:<PORT>/<DB>
com.ashna.jturbo.driver.Driver

Microsoft SQL Server (Sprinta Driver)


jdbc:inetdae:<HOST>:<PORT>?database=<DB>
com.inet.tds.TdsDriver

Microsoft SQL Server 2000 (Microsoft Driver)


jdbc:microsoft:sqlserver://<HOST>:<PORT>[;DatabaseName=<DB>]
com.microsoft.sqlserver.jdbc.SQLServerDriver

MySQL (MM.MySQL Driver)


jdbc:mysql://<HOST>:<PORT>/<DB>
org.gjt.mm.mysql.Driver
com.mysql.jdbc.Driver

Oracle OCI 8i
jdbc:oracle:oci8:@<SID>
oracle.jdbc.driver.OracleDriver

Oracle OCI 9i
jdbc:oracle:oci:@<SID>
oracle.jdbc.driver.OracleDriver

PostgreSQL (v6.5 and earlier)


jdbc:postgresql://<HOST>:<PORT>/<DB>
postgresql.Driver

PostgreSQL (v7.0 and later)


jdbc:postgresql://<HOST>:<PORT>/<DB>
org.postgresql.Driver

Sybase (jConnect 4.2 and earlier)


jdbc:sybase:Tds:<HOST>:<PORT>
com.sybase.jdbc.SybDriver

Sybase (jConnect 5.2)


jdbc:sybase:Tds:<HOST>:<PORT>
com.sybase.jdbc2.jdbc.SybDriver

To test your driver once it's installed, try the following code:

try
{
Class.forName("Driver name");
Connection con = DriverManager.getConnenction("jdbcurl","username","password");
//other manipulation using jdbc commands
}
catch(Exception e)
{
}

You might also like