The moose likes Websphere and the fly likes JNDI lookup for DataSource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "JNDI lookup for DataSource" Watch "JNDI lookup for DataSource" New topic

JNDI lookup for DataSource

prachi jahagirdar

Joined: Feb 02, 2004
Posts: 11
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
Suttan Pym
Ranch Hand

Joined: Jan 30, 2003
Posts: 46
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).
I agree. Here's the link:
subject: JNDI lookup for DataSource
It's not a secret anymore!