Getting DataSource from WAS - Cllient is outside the Container
posted 9 years ago
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?