Jdbc - URL (and Driver Class)

> Procedural Languages > Java > JDBC (Java Database Connectivity)

1 - About

JDBC is using URL to locate the database schema.

Database URLs are strings that you specify for the value of the url property of the DataSource object.

You can add to all JDBC URL, the user and the password in the query part. Example

jdbc:subProtocol://hostname;user=[userName];password=[userPassword];DatabaseName=[Databasename]

The userName and the userPassword must be encoded as all query properties.

Advertising

3 - URL

The format of a url is follow a hierarchic URL : jdbc:<subprotocol>:<subname>

where:

  • subprotocol defines the kind of database connectivity mechanism that may be supported by one or more drivers. The contents and syntax of the subname will depend on the subprotocol.

4 - Default Values

4.1 - Hyperion

4.1.1 - Microsoft SQL Server 2005

  • driver= hyperion.jdbc.sqlserver.SQLServerDriver
  • url= jdbc:hyperion:sqlserver://[hostname]:[port];DatabaseName=[Databasename]

4.1.2 - Microsoft SQL Server 2000

  • driver= hyperion.jdbc.sqlserver.SQLServerDriver
  • url= jdbc:hyperion:sqlserver://[hostname]:[port];DatabaseName=[Databasename]

4.1.3 - IBM Db2 Universal Database version 9

  • driver= hyperion.jdbc.db2.DB2Driver
  • url= jdbc:hyperion:db2://[host]:[port];DatabaseName=[dbname]
Advertising

4.1.4 - IBM Db2 Universal Database version 8

  • driver= hyperion.jdbc.db2.DB2Driver
  • url= jdbc:hyperion:db2://[host]:[port];DatabaseName=[dbname]

4.1.5 - Sybase Adaptive Server Enterprise 15

  • driver= hyperion.jdbc.sybase.SybaseDriver
  • url= jdbc:sybase:Tds:[host]:[port]

4.2 - DB2

  • jar: db2java.zip

4.3 - Odbc Bridge

see JDBC - ODBC bridge

  • Driver Class= sun.jdbc.odbc.JdbcOdbcDriver
  • Jdbc Url= jdbc:odbc:[dsn]

4.4 - Oracle

4.4.1 - Oracle 11g

  • Driver Class= oracle.jdbc.OracleDriver
  • url= jdbc:oracle:thin:@[host]:[port]:[sid] (connection by SID is deprecated)
  • url= jdbc:oracle:thin:@[host]:[port]/[servicename]
  • jar: ojdbc6.jar

The colon “:” implies SID, the slash “/” implies service_name.

Example:

jdbc:oracle:thin:scott/[email protected]:1521:mysid
Advertising

4.4.2 - Oracle 10g

  • driver= oracle.jdbc.OracleDriver
  • url= jdbc:oracle:thin:@[host]:[port]:[sid]

4.4.3 - Oracle 9i

  • driver= oracle.jdbc.OracleDriver
  • url= jdbc:oracle:thin:@[host]:[port]:[sid]

4.5 - Oracle BI Server (OBIEE)

  • driver= oracle.bi.jdbc.AnaJdbcDriver
  • url= jdbc:oraclebi://[host]:[port]/ (default: jdbc:oraclebi://hostName:9703/ )

With user: jdbc:oraclebi://localhost:9703/user=Nico;password=********;

Others parameters:

  • SECONDARYCCSPORT=9706
  • MAXRECONNECTATTEMPTS=3
  • TRUSTANYSERVER=true
  • PRIMARYCCSPORT=9706
  • MAXRPCCLIENTCREATEATTEMPTS=3
  • USER=ngerarlocal
  • HEARTBEATINTERVAL=60
  • MAXHEARTBEATATTEMPTS=3
  • MAXRPCCLIENTCOUNT=100
  • SSL=false
  • TRUSTSTOREPASSWORD=***
  • PASSWORD=***
  • SECONDARYCCS=
  • PORT=9703
  • CATALOG=
  • HOST=localhost
  • PRIMARYCCS=
  • SSLKEYSTOREPASSWORD=***
  • RPCCLIENTEXPIRATIONTIME=60

4.6 - SQL Server

4.6.1 - 2008 R2

  • driver = com.microsoft.sqlserver.jdbc.SQLServerDriver
  • url = jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]

Example:

jdbc:sqlserver://localhost;user=MyUserName;password=*****;databaseName=AdventureWorks;
  • jar: sqljdbc.jar

4.7 - Sybase IQ 12

  • driver= om.sybase.jdbc3.jdbc.SybDriver
  • url= jdbc:sybase:Tds:[host]:[port]?ServiceName=[database_name]

4.8 - Informix IDS 10.0

  • driver= com.informix.jdbc.IfxDriver
  • url= jdbc:informix-sqli://[host_name]:[port_number]/[database_name]:INFORMIXSERVER=[server_name]

4.9 - Informix IDS 9.4

  • driver= com.informix.jdbc.IfxDriver
  • url= jdbc:informix-sqli://[host_name]:[port_number]/[database_name]:INFORMIXSERVER=[server_name]

4.10 - Teradata

  • jar: terajdbc4.jar, log4j.jar, teradata.jar, tdgssjava.jar, tdgssconfig.jar

4.10.1 - NCR Teradata 12.0

  • driver= com.ncr.teradata.TeraDriver
  • url= jdbc:teradata://[DatabaseServerName]

4.10.2 - NCR Teradata V2R6.2

  • driver= com.ncr.teradata.TeraDriver
  • url= jdbc:teradata://[DatabaseServerName]

4.10.3 - NCR Teradata V2R5.1

  • driver= com.ncr.teradata.TeraDriver
  • url= jdbc:teradata://[DatabaseServerName]

4.11 - MySQL

4.11.1 - MySQL 5.0

  • driver= com.mysql.jdbc.Driver
  • url= jdbc:mysql://[host]:[port]/[database]
  • jar: Mysql-connector-java*.jar

4.11.2 - MySQL 4.1

  • driver= com.mysql.jdbc.Driver
  • url= jdbc:mysql://[host]:[port]/[database]

4.12 - Netezza 4.0

  • driver= org.netezza.Driver
  • url= jdbc:netezza://[host]:[port]/[database]

4.13 - TimesTen

The driver= com.timesten.jdbc.TimesTenDriver. The jar driver is located int the TIMESTEN_BASE\lib directory. The jar file ttjdbc5.jar is for the Java SDK version 5 and ttjdbc6.jar is for version 6. (ttjdbc5.jar, ttjdbc6.jar)

URL:

jdbc:timesten:{direct|client}:dsn=DSNname;[DSNattributes;]

Example:

jdbc:timesten:client:dsn=TT_DATA_STORE;UID=login;Pwd=pwd;SQLQUERYTIMEOUT=0

4.14 - RPAS 13.0.1 int1

  • driver= jdbc.sql.oadriver
  • url= jdbc:OpenRDA:[DSN Name]

4.15 - Java DB - Derby

4.15.1 - Embedded

For the Embedded configuration

  • Driver: org.apache.derby.jdbc.EmbeddedDriver.
  • URL: jdbc:derby:databaseName;URLAttributes where:
    • databaseName. The name of the database that you want to connect to
    • URLAttributes. One or more of the supported attributes of the database connection URL, such as ;territory=ll_CC or ;create=true.

4.15.2 - Client/server

For the client/server communication:

  • Driver: org.apache.derby.jdbc.ClientDriver.
  • URL: jdbc:derby://server[:port]/databaseName[;URLAttributes=value[;...]] where:
    • the server and port specify the host name (or IP address) and port number where the server is listening for requests
    • databaseName is the name of the database you want to connect to.
    • URLAttributes can be either Derby embedded or network client attributes.

5 - Documentation / Reference

lang/java/jdbc/url.txt · Last modified: 2019/05/14 14:54 by gerardnico