File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes IBM Websphere 5 Connection Pool Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "IBM Websphere 5 Connection Pool" Watch "IBM Websphere 5 Connection Pool" New topic

IBM Websphere 5 Connection Pool

Imad Uddin Chishti

Joined: Oct 13, 2002
Posts: 15
Can someone please reconfigure following code for Websphere 5. This code is for websphere 3.5
package cfas;
import java.sql.*;
import java.util.*;
import javax.sql.*;
import javax.naming.*;
public class ConnectionPool{
private static DataSource ds = null;
private static Connection conn=null;
private static Context ctx;
private static int firstTime = 0;
public static synchronized Connection getConnection() throws SQLException
try {
if ( firstTime == 0 )
firstTime = 1;
Hashtable parms = new Hashtable();
ctx = new InitialContext(parms);
ds = (DataSource)ctx.lookup("jdbc/DB2TST01");
conn = ds.getConnection("saz","saz");
catch (Exception e ) { System.out.println("connection()Naming execption:" + e.getMessage()); }
return conn;
public static synchronized void freeConnection(Connection back)
try {back.close();}
catch (SQLException e) { System.out.println("Close Time Exactly()"+e.getMessage());}

Imad Uddin Chishti<br />Sun Certified JAVA Programmer platform 2<br />Senior Consultant<br />BearingPoint Pakistan
I agree. Here's the link:
subject: IBM Websphere 5 Connection Pool
It's not a secret anymore!