Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting DataSource from WAS - Cllient is outside the Container

 
Anurag Gupta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As per my experience with websphere, We can not get the connection from datasource out of the container.

Shailesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic