RSS Feed for This PostCurrent Article

New JDBC URL Syntax for Oracle 10g JDBC Driver

This is something you might have overlooked if you are using Oracle JDBC Driver.

Prior to Oracle 10g, the syntax for the JDBC URL looks like below

jdbc:oracle:<driver_type>:@hostname:<;listener-port>:<SID> 

E.g.

jdbc:oracle:thin:@db.oracle.com:1521:mydb
 
 

However, there is a special THIN style service name syntax supported with only THIN JDBC driver that was introduced in 10g JDBC driver

jdbc:oracle:thin:@//host_name:port_number/service_name

Here is an example,

jdbc:oracle:thin:scott/[email protected]//myhost:1521/myservicename

The format of URL introduced Oracle 10g

jdbc:oracle:driver_type:[username/password]@database_specifier

E.g.

jdbc:oracle:thin:@(DESCRIPTION=
 (ADDRESS_LIST=
 (ADDRESS=(PROTOCOL=TCP)(HOST=localhost) (PORT=1521))
 (CONNECT_DATA=(SERVICE_NAME= service_name)))
 
jdbc:oracle:thin:@(DESCRIPTION=
  (LOAD_BALANCE=on)
(ADDRESS_LIST=
  (ADDRESS=(PROTOCOL=TCP)(HOST=localhost) (PORT=1521))
  (ADDRESS=(PROTOCOL=TCP)(HOST=host2)(PORT=1521)))
  (CONNECT_DATA=(SERVICE_NAME= service_name)))
 
 

Old syntax still works but maybe will be deprecated in future.

More reference can be found at http://download-west.oracle.com/docs/cd/B14117_01/java.101/b10979/urls.htm


Trackback URL


Sorry, comments for this entry are closed at this time.