Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DataSource.getConnection() returning closed connections

 
Rocker Jagtap
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi,
can you show us the implementation of ?
that should give us some idea.
 
Rocker Jagtap
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply, here is code behind datasource.getConnection();
 
Gurumeet Singh Ahuja
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic