JDBC Connection URLs for 23 Databases

Here is a non-exhaustive list of JDBC connection URLs for various databases. Corrections welcome!

Microsoft SQL Server JDBC connection URL

jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=northwind
com.microsoft.jdbc.sqlserver.SQLServerDriver
msbase.jar;mssqlserver.jar;msutil.jar
download

Microsoft SQL Server 2005 JDBC connection URL

jdbc:sqlserver://serverNameinstance:port[;user=value][;password=value][;property=value]
com.microsoft.sqlserver.jdbc.SQLServerDriver
sqljdbc.jar
download SQL Server 2005 driver

Microsoft SQL Server (JTurbo) JDBC connection URL

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

Microsoft SQL Server (Sprinta) JDBC connection URL

jdbc:inetdae7:<HOST>:<PORT>?database=<DB>
com.inet.tds.TdsDrive
download

Cloudscape JDBC connection URL

jdbc:cloudscape:MyDataBase
COM.cloudscape.core.JDBCDriver

Cloudscape RMI JDBC connection URL

jdbc:rmi://hostname:portnumber/jdbc:cloudscape:MyDatabase
RmiJdbc.RJDriver

Hypersonic SQL (file)

The file path is either a relative or absolute path to the database file. The example below includes the drive name

jdbc:hsqldb:file:C:/data/mydb
org.hsqldb.jdbcDriver
hsqldb.jar

Download (Sourceforge)

Hypersonic SQL (server) JDBC connection URL

jdbc:hsqldb:hsql://localhost
org.hsqldb.jdbcDriver
hsqldb.jar
download (SourceForge)

Hypersonic SQL (in-process) JDBC connection URL

jdbc:hsqldb:file:/opt/db/testdb
org.hsqldb.jdbcDriver
hsqldb.jar

Hypersonic SQL (in-memory) JDBC connection URL

jdbc:hsqldb:mem:aname
org.hsqldb.jdbcDriver
hsqldb.jar

H2 Database (embedded)

jdbc:h2:test

H2 Database (Client Server)

jdbc:h2:tcp://localhost:9092/test

H2 Database (Client Server, Clustered)

jdbc:h2:tcp://localhost:9092,backuphost.com:9092/test

H2 Database (In Memory)

jdbc:h2:{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]

Informix JDBC connection URL

jdbc:informix-sqli://hostname:portnumber/MyDatabase:INFORMIXSERVER=MyServerName
com.informix.jdbc.IfxDriver

MySQL JDBC connection URL

jdbc:mysql:///test
jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...
com.mysql.jdbc.Driver

Oracle JDBC connection URL

jdbc:oracle:thin:@localhost:1521:MyDatabase
oracle.jdbc.driver.OracleDriver
classes12.zip

To reference the Oracle SID (Service name), you have to apply // in front of the host name.

jdbc:oracle:thin:myusername/mypassword@//localhost:1521/PROD.OCZH.CH

To connect to your database using a tnsnames.ora entry,

System.setProperty("oracle.net.tns_admin",
                        "D:\oracle\product\10.2.0\db_1\NETWORK\ADMIN");
or
Doracle.net.tns_admin=D:oracleproduct10.2.0db_1NETWORKADMIN
jdbc:oracle:thin:@mysvcname

PostgresSQL JDBC connection URL

jdbc:postgresql:template1
org.postgresql.Driver

DB2 JDBC connection URL

jdbc:db2:test
com.ibm.db2.jdbc.app.DB2Driver

TimesTen in-memory database JDBC connection URL

jdbc:timesten:direct:test
com.timesten.jdbc.TimesTenDriver

DB2/400 (native) JDBC connection URL

jdbc:db2://systemname
com.ibm.db2.jdbc.app.DB2Driver

DB2/400 (toolbox) JDBC connection URL

jdbc:as400://systemname
com.ibm.as400.access.AS400JDBCDriver

Derby JDBC connection URL

jdbc:derby:/test;create=true
org.apache.derby.jdbc.EmbeddedDriver

Derby JDBC network connection URL

jdbc:derby://localhost:1527/sample;user=judy;password=no12see
jdbc:derby://localhost:1527/c:/my-db-dir/my-db-name;user=judy;password=no12see
org.apache.derby.jdbc.ClientDriver

Note that authentication is off by default. To enable user authentication, the property derby.connection.requireAuthentication must be set to true. This is set in the derby.properties file.

Sybase JDBC connection URL

jdbc:sybase:Tds:localhost:2048/MyDatabase
com.sybase.jdbc2.jdbc.SybDriver
jconn2.jar
download

Mckoi SQL JDBC connection URL

jdbc:mckoi:local://C:/mckoi1.0.3/db.conf
com.mckoi.JDBCDriver

SAP DB JDBC connection URL

jdbc:sapdb://localhost/TST
com.sap.dbtech.jdbc.DriverSapDB

JSQL JDBC connection URL

jdbc:JSQLConnect://localhost/test
com.jnetdirect.jsql.JSQLDriver

JTurbo JDBC connection URL

jdbc:JTurbo://localhost:1433/test
com.newatlanta.jturbo.driver.Driver

jTDS JDBC connection URL

jdbc:jtds:sqlserver://localhost/dbName;instance=instanceName 
net.sourceforge.jtds.jdbc.Driver

(thanks JoelN for the correction)

Interbase (Java driver) JDBC connection URL

jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
org.firebirdsql.jdbc.FBDriver

Interbase (Interclient driver) JDBC connection URL

jdbc:interbase://localhost:3060/C:/firebird/test.gdb
interbase.interclient.Driver

PointBase JDBC connection URL

jdbc:pointbase:embedded:sample
com.pointbase.jdbc.jdbcUniversalDriver

Ingres JDBC connection URL

ca.edbc.jdbc.EdbcDriver
jdbc:edbc://localhost:II7/database

Mimer SQL JDBC connection URL

jdbc:mimer:multi1
com.mimer.jdbc.Driver

Sources


About this entry