This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Websphere and the fly likes Getting DataSource from WAS - Cllient is outside the Container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Getting DataSource from WAS - Cllient is outside the Container" Watch "Getting DataSource from WAS - Cllient is outside the Container" New topic
Author

Getting DataSource from WAS - Cllient is outside the Container

Anurag Gupta
Ranch Hand

Joined: Dec 13, 2001
Posts: 40
I am trying to get a database connection from a Java client application, which is outside the WAS container. i.e. a standalone java class.
A working DataSource is already configured in WAS 6, with connection pool [Security is NOT enabled].

A deployed servlet with the following code works fine:


However if the java client outside the container, trys to get a connection from the same Connection pool, there is a error. (The difference is in getting the InitialContext only)



This code, throws a ClassCastException , because the l_obj returned is not of type DataSource, but of Resource type.

1) Does that mean, Webspher does not allow its own DataBase connection pool to be used outside the container ?
2) If it is allowed, then how do accomplish this, in a standlaone java client?

Thanks


Anurag Gupta
Shailesh Chandra
Ranch Hand

Joined: Aug 13, 2004
Posts: 1081

As per my experience with websphere, We can not get the connection from datasource out of the container.

Shailesh


Gravitation cannot be held responsible for people falling in love ~ Albert Einstein
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting DataSource from WAS - Cllient is outside the Container
 
Similar Threads
How to configure hsqldb in struts 1.3.8?
Database and J2ee server help needed!
Understand IntialContext
Do you need to make a java file for your datasource or connection pool?
Setting up Datasource object