aspose file tools*
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "IBM Websphere 5 Connection Pool" Watch "IBM Websphere 5 Connection Pool" New topic
Author

IBM Websphere 5 Connection Pool

Imad Uddin Chishti
Greenhorn

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 com.ibm.ejs.dbm.jdbcext.*;
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();
parms.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
ctx = new InitialContext(parms);
ds = (DataSource)ctx.lookup("jdbc/DB2TST01");
}
conn = ds.getConnection("saz","saz");
conn.setAutoCommit(true);
}
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: http://aspose.com/file-tools
 
subject: IBM Websphere 5 Connection Pool