File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes closing pooled connection with WS naming service(jndi) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "closing pooled connection with WS naming service(jndi)" Watch "closing pooled connection with WS naming service(jndi)" New topic
Author

closing pooled connection with WS naming service(jndi)

prashant patel
Ranch Hand

Joined: May 02, 2000
Posts: 69
hi,
The follwing code gets me a pooled connection from the lookup service of websphere.

import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public class DbConnection
{
private Connection con;
public DbConnection()
{
try{
Context ctx = new InitialContext();
DataSource ds=(DataSource)ctx.lookup("jdbc/Default DataSource");
con = ds.getConnection("username","passwd");
}catch(NamingException ne){
System.err.println("Naming Exception " + ne.getMessage());
}catch(SQLException sql){
System.err.println("SQLException " + sql.getMessage());
}
}
public Connection getConnection()
{
return con;
}
}
after sucessfully using the pooled connection, when we close the
connection using con.close() method the connection should be returned to the pool, to my notice the application is really slow and the guess is the connection are not been returned to the pool, this procedure is described in the infocenter avaiable at the ibm site. when i was a normal connection we used to moniter the connection status by issuing a sql statement and came to know how many connection are been taken up, in websphere how can i know how many connections are been used and how many in the pool. I have also increased the connection to 50 pooled connection throught the websphere java console.
thanks.

prashz
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: closing pooled connection with WS naming service(jndi)