Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

JNDI lookup for DataSource

Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.naming.Context jndiCntx=new javax.naming.InitialContext();
javax.sql.DataSource ds
c = ds.getConnection(getUID(),getPassword().trim());
s = c.createStatement();
//}catch(javax.naming.NamingException e){e.printStackTrace();}
}catch(Exception e){Log.print(":Exception = "+e);
In the above code i am trying to get connected to the DB2. Working with Webspehere 5.0. I am new to Webspehere. Created a JDBC Provider for DB2. Created a datasource with jndi name 'jdbc/home'.
**The exception i am getting is:
Exception = Connection not available, Timed out waiting.
Is there anything else to be done to get the connection?
Thank you
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not exactly sure of your problem, but I would make a try to help you. Normally this Exception occurs if all the Connections in the pool are used and when a request for a new Connection is given to the DataSource after the Connection timeout, it throws this Exception. May be by increasing the timeout time or by increasing the connections in the pool could solve the problem.
At the same time check it ther is any Connection leaks in the code. Whenever Connection use is complete close (it would be better you close the connection in finally, so that even in the case of Exception the Connection would be closed).
    Bookmark Topic Watch Topic
  • New Topic