This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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?