Websphere Connection Pooling


Performance and scalability: Websphere Connection Pooling

  1. Websphere Connection Pooling (11 messages)

    What support does Websphere3.5 provide for connection pooling while using JSP's.

    Threaded Messages (11)

  2. Websphere Connection Pooling[ Go to top ]

    WebSphere 3.5 allows you to configure a DataSource object that will handle the pooling for you. The Admin console provides a wizard that will walk you through the process.

    After you set it up, then you use JNDI to "lookup" the DataSource object, and ask it for a connection. It pools the connections(however many you specified) for you. When you close the Connection...it doesnt actually close, its just returned to the pool.

  3. Websphere Connection Pooling[ Go to top ]


    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.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;

    public class ConPool extends 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){

  4. Websphere Connection Pooling[ Go to top ]

    When you have made a ConnectionPooled DataSource through WebSphere console itself then you do not have to write a redundant code of putting the DataSource again you just need the following :

    try {
    Properties env = new Properties();
    env.put (javax.naming.Context.PROVIDER_URL, "iiop:///");
    env.put (javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
    javax.naming.Context jndiCtx = new javax.naming.InitialContext(env);
    String dataSourceName = "jdbc/OraTest";
    DataSource dataSource = (DataSource)jndiCtx.lookup(dataSourceName);
    } catch (javax.naming.NamingException e) {

  5. Websphere Connection Pooling[ Go to top ]

    Make sure DB2JAVA.zip is in your classpath and use this one...


  6. Websphere Connection Pooling[ Go to top ]

    Oops..forgot your using Oracle.

    There should be a similar solution for the Oracle pool.
  7. Websphere Connection Pooling[ Go to top ]

    You probably just need to dig around and find the .jar file that contains the javax.sql.DataSource. Make sure its included in your classpath.
  8. Websphere Connection Pooling[ Go to top ]

    Thanks buddy!!! I got the thing working and really appreciate your help.

    Balbir Singh
  9. How to use Connection Pooling in an java application. I have succesfully used in Servlets/jsp, but having problems in using from a application. How does an application use the JNDI Naming Context.

    Any help would be appreciated.

  10. Same exact way. Just make sure you have the JNDI classes in your classpath and your good to go.
  11. Now it is working fine for me. ThankYou Weston, you are right, the problem was JNDI not being in the classpath. Also, I was thinking how to use the same remotely. I mean a java application with a Websphere Test Environment trying to use the remote system (LAN) connection pooling JNDI.
  12. new to websphere[ Go to top ]

    Hi Balber singh, how ru.Actual i'am new to websphere ,i know how to configure the datasource in webphere,but i don't know how to access that datasource.....can u plz send ur sample code that worked for u