Inside Scoop on J2EE : Tips and tricks on J2EE and Oracle Application Server by Debu Panda
Updated: 11/18/2004; 5:19:20 PM.

 

Subscribe to "Inside Scoop on J2EE" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Thursday, September 16, 2004

 

 After too much deliberation we have finally decided to bundle ant with our product. Prior to this release we always required customers to have ant available. With the next release of our product we decided to have ant preconfigured to use our product specific tasks. We are still debating whether we want to leave the modified launch script as ant.sh (and ant.bat) or name it something else e.g. Sun has asant  with J2EE 1.4 SDK.  As a developer does the name of the ant launch script matter to you ? Is it an extra command for a developer to remember when building/deploying an application. If you do not like the launch script other than ant , it’s time to rant  (by adding a comment.)


3:19:35 PM    comment []

 

JDBC being core to most enterprise Java applications, I always try to keep myself up-to-date with JDBC and the changes in Oracle JDBC drivers. Like any casual readers I skipped many things in user guides and missed the JDBC URL changes until recently. Many of these changes were introduced in 9.2 JDBC drivers but the old style syntax was still documented in 9.2 JDBC Guide.

 

This change will impact you only if you follow a bad practice of hardcoding JDBC URLs in your source code . If you are using a J2EE container this requires just a change in the Data Sources configuration.

 

In the prior releases Oracle JDBC driver required the following syntax for the JDBC URL:

 

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

 

Here is an example URL if I use THIN driver with database SID as db

 

jdbc:oracle:thin:@oc4j.us.oracle.com:1521:db

 

 

There is special THIN style Service name syntax supported with only THIN JDBC driver that was introduced in 10g JDBCdriver (This is one most Java developers will care)

 

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

 

 

Here is an example of an URL that uses THIN style syntax

 

jdbc:oracle:thin:scott/tiger@//myhost:1521/myservicename

 

 

The format for URL in 10g has been mandated to follow although this was introduced in 9.2 as follows: (The old style syntax has been removed from the 10g documentation)

 

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

 

Here is an example of the URL with the new convention using the THIN driver with an address list

 

 jdbc:oracle:thin:@(DESCRIPTION=

  (ADDRESS_LIST=

  (ADDRESS=(PROTOCOL=TCP)(HOST=localhost) (PORT=1521))

  (CONNECT_DATA=(SERVICE_NAME= service_name)))"

Here is an example of the URL with the new convention using the THIN driver that has an address list with load balancing switched on:

 

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)))"

 

Here is an example URL that uses OCI driver in a cluster

 

jdbc:oracle:oci:@(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)
(HOST=cluster_alias)PORT=1521))
 (CONNECT_DATA=(SERVICE_NAME=service_name)))" 

  

The old style syntax is deprecated but still works and may be de-supported in future so it is recommended to use the new syntax for the URL.

 

 

There are many other formats that you can use, for details, please refer to Oracle JDBC Driver 10g Guide.


12:42:15 PM    comment []

© Copyright 2004 Debu Panda.

PS: These are my own thoughts and not of my employer ..



Click here to visit the Radio UserLand website.
 


September 2004
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Aug   Oct