aspose file tools*
The moose likes Websphere and the fly likes Multi datasource in websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Multi datasource in websphere" Watch "Multi datasource in websphere" New topic
Author

Multi datasource in websphere

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
How to create multi datasource in websphere

I need this functionality in websphere :

The multi data source distributes connection requests evenly to its member data sources. With this algorithm, the multi data source also provides failover processing. That is, if a request fails, the multi data source sends the request to the next data source in the list until a valid connection is obtained, or until the end of the list is reached, in which case an exception is thrown.

Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
What version of WebSphere App Server are you using ?

Starting WAS 6.1.0.27 a new datasource custom property allows you to specify a CSV list of database server/port which act as failover dataservers.

I have tested it with Oracle 10g and Oracle 11g.

Let me know if you need further help.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Thanks Deepak,

I am using 7.0, so no issues I guess. How about RAC(Real Application Clusters). Have you tried ?

If so Please assist me.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
Yes I have used RAC as well. It can be achieved via both Type 4 and Type 2 Oracle drivers.

1. Under WebLogic there is a concept of Multipool, which is like a pool of connection pool. You configure it either as load-balanced or as high-available pool. Under this option you can use Type 4 Oracle Thin Driver. If you dont want to configure multi-pool then you can use Type 2 OCI driver.

2. Under WebSphere 6.x and beyond the support for RAC can be achieved as follows:

(a) Configure one connection pool but use Type 2 Oracle OCI driver. The connection string for the OCI driver (either under WebSphere or in TNSNAMES.ora) contains the information about both the RAC nodes and it will handle transparent application fail-over (TAF). To be able to use OCI driver from WebSphere machines, you will need to install Oracle client libraries on them. This client install is not needed in case of Type 4 JDBC drivers.

(b) Configure one connection pool but use Type 4 Oracle JDBC driver. The custom property of database servers will need to be configured in this case. The only issue here is that it works in high-availability mode. So all requests will go to first database node. When the first node fails it will go to the first server listed in the failover property and so on.

I think using OCI driver is a better option for effectively using all the RAC nodes.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Woow Great Deepak,

Thanks a lot for your information. To handle the RAC whether I need to configure it in Datasource alone is enough or I need to handle in the Java code.

Please assist me. Also is there any links or sample codes
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
No you dont need to do anything in the Java code that runs under the application server. The promise of RAC is TAF, which stands for transparent application failover. You just need to configure proper connection string for the JDBC driver. The OCI would be a better option but you can use TAF using Type 4 driver as well.

You can search at oracle.com for connection string. Otherwise I will dump the connection string for you.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Deepak,

I got something, could you please review this or give me a new one.

URL - 1


URL - 2



Deepak,

While creating the datasource in the Websphere application server instead of plain url, I need to submit the above url rite. That will enable the RAC failover for me.
Please correct me if I am wrong.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
The above URLs look good to me. Yes this is the connect string that you will have to use in WebSphere connection pool.

Besides oracle.com and tom kyte article, you can also get help on RAC at this link:
http://www.dba-oracle.com/art_oramag_rac_taf.htm

Another thing to decide is if you want to use your RAC nodes as Active-Active or Active-Passive.

You will have to take help from your DBA to execute V$ queries to find out, which RAC node you are connecting to.

Also create a series of test case(s) and sample code that executes long running queries (or add Thread.sleep()) so that DBA can force shutdown one node after another. The application should be able to use TAF effectively. I used it in Oracle 9i and I know RAC has come a long way since then.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Deepak,

In the below URL Fast Connection Failover is not enabled rite ?. something like FastConnectionFailoverEnabled=true

Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
I have only used TAF with RAC. You can get more information about FCF at following link:
http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/fstconfo.htm#CIHJGCFE

In your project schedule you should plan for at least 1-2 weeks of testing various key features of RAC.
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Deepak,

Finally I got the URL for Enabling the RAC with FCF. I pasted the URL below for OC4J server. Need to check for websphere Server. I guess the URL will not change depends on the server rite ?

In case If I don't have the RAC setup, Then I can give the schema details in node 1 and then I can try to connect rite.

Data Source
--------------


Connection Pool
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
The URL should be same across WebLogic and/or WebSphere. I would suggest that if you want you can create some websphere variables to define the value of the URL. Then use the variable in the datasource. This way you will be able to abstract some portions of the URL.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multi datasource in websphere