aspose file tools*
The moose likes JBoss/WildFly and the fly likes DataSource.getConnection() returning closed connections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "DataSource.getConnection() returning closed connections" Watch "DataSource.getConnection() returning closed connections" New topic
Author

DataSource.getConnection() returning closed connections

Rocker Jagtap
Greenhorn

Joined: Aug 04, 2008
Posts: 2
Hi,
I am having an application which is running on Jboss and Oracle database. I get closed connections while doing Datasource.getConnection(). here is the code

Can some one please let me know, why datasource is returning closed connections

thanks
ravi
Abid Rafique
Greenhorn

Joined: Jan 09, 2012
Posts: 10

Ravi,
can you show us the implementation of ?
that should give us some idea.
Rocker Jagtap
Greenhorn

Joined: Aug 04, 2008
Posts: 2
thanks for the reply, here is code behind datasource.getConnection();
Gurumeet Singh Ahuja
Greenhorn

Joined: Mar 02, 2012
Posts: 4
Hi,

Is this the complete snippet for the method.. as i see szDataSource is always null.... and even if its set in the class level [not visible in this snippet] its re-assigned as null again.

String szDataSource = null;
if (datasource == null) {
try {
htParms = new Hashtable();
htParms.put(Context.PROVIDER_URL, szProviderURL);
htParms.put(Context.INITIAL_CONTEXT_FACTORY, szContextFactory);
context = new InitialContext(htParms);
temp = context.lookup(szDataSource);
datasource = (DataSource) temp;
context = null;
}

Thanks!

~Gurumeet
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: DataSource.getConnection() returning closed connections