This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Websphere and the fly likes Websphere Connection Pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Websphere Connection Pooling" Watch "Websphere Connection Pooling" New topic

Websphere Connection Pooling

Balbir Singh
Ranch Hand

Joined: Jun 01, 2001
Posts: 79
What support does Websphere 3.5 provide for connection pooling while using JSP's.

Thanks and Regards<br />Balbir Singh<br />Sun Certified Java Programmer<br />IBM Certified Administrator for WebSphere4.0
Heath Lilley
Ranch Hand

Joined: Jan 09, 2001
Posts: 72
Websphere 3.5 has full support for JNDI and DataSources. We have 2 apps running with no problems.
You just need to use IBMs context factory class.
And have your Database Drivers in the class path for the current webapp you are working on.
Balbir Singh
Ranch Hand

Joined: Jun 01, 2001
Posts: 79

Thanks for the reply.

I have made up a datasource name OraTest through Admin Console in Websphere and written the code given below. The problem is I am not able to compile it since its not finding the javax.sql.* packageg. If you can pls help:

import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
import javax.sql.*;

public class ConPoolextends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException{
PrintWriter out = res.getWriter();
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;
Properties prop = new Properties();
prop.put(DataSourceFactory.NAME, "OraTest");
prop.put(DataSourceFactory.DATASOURCE_CLASS_NAME, "oracle\jdbc\pool\OraclePooledConnection");
prop.put(DataSourceFactory.DESCRIPTION, " Connection Pooling using Oracle thin driver");
DataSource ds=DataSourceFactory.getDataSource(prop);
catch(Exception e){

Hashtable env=new Hashtable();
javax.naming.Context ctx = new javax.naming.InitialContext(env);
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("jdbc/OraTest");
rs=stmt.executeQuery("Select * from tb_users");
catch(Exception e){

Balbir Singh
Ranch Hand

Joined: Jun 01, 2001
Posts: 79
I got the thing working.
Joe Nguyen
Ranch Hand

Joined: Apr 20, 2001
Posts: 161
Just for those who do not know the solution. You need to import the project/or package into your workbench.
Ram Kondawar
Ranch Hand

Joined: May 29, 2001
Posts: 42
Can you please tell me why you require the code pertaining to the creation of the datasource is required in the servlet, after you have configured the datasource in admin console.
Can't we straight away do the lookup and get the datasource in the servlet code. Please clarify.
Thanks in advance
Ram Kondawar
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Websphere Connection Pooling