This is a static method I am using to obtain a connection from the connection pool....

public static Connection getConnection() throws SQLException
{
        System.out.println("EJBUTIL : getConnection(1)");
        InitialContext initCtx = null;
        System.out.println("EJBUTIL : getConnection(2)");
        String url = "java:comp/env/jdbc/sqlPool";
        System.out.println("EJBUTIL : getConnection(3)");
        try
        {
                System.out.println("EJBUTIL : getConnection(4)");
                initCtx = new InitialContext();
                System.out.println("EJBUTIL : getConnection(5)");
                DataSource ds = (javax.sql.DataSource)initCtx.lookup(url);
                System.out.println("EJBUTIL : getConnection(6)");
                System.out.println("datasource "+ds);
                return ds.getConnection();
        }
        catch(NamingException ne)
        {
                System.out.println("UNABLE to get a connection from sqlPool!");
                System.out.println("Please make sure that you have setup the 
connection pool properly");
                throw new EJBException(ne);
        }
        finally
        {
                try
                {
                        if(initCtx != null) initCtx.close();
                }
                catch(NamingException ne)
                {
                        System.out.println("Error closing context: " + ne);
                        throw new EJBException(ne);
                }
        }
}
On Thursday, December 07, 2000 at 02:28:57 PM, A mailing list about Java Server Pages 
specification and reference wrote:

> Hi
>
> i m using Weblogic server,,, i have created the connection pool by this way
>
> weblogic.jdbc.connectionPool.oraclePool=\
>        url=jdbc:weblogic:oracle,\
>        driver=weblogic.jdbc.oci.Driver,\
>        loginDelaySecs=1,\
>        initialCapacity=4,\
>        maxCapacity=10,\
>        capacityIncrement=2,\
>        allowShrinking=true,\
>        shrinkPeriodMins=15,\
>        refreshMinutes=10,\
>        testTable=dual,\
>        props=user=rausr;password=rausr;server=fo
>
>  weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePool=everyone
>  weblogic.allow.reset.weblogic.jdbc.connectionPool.oraclePool=everyone
>  weblogic.allow.shrink.weblogic.jdbc.connectionPool.oraclePool=everyone
>  weblogic.jdbc.connectionPoolcreate.admin=everyone
> weblogic.jdbc.TXDataSource.weblogic.jdbc.jts.oraclePool=oraclePool
>
>
> now the probelm is that,, i dont know how i use this connection pool in my
> jsp page.
> how can i use it...???
>
> Best Regards
> Asim
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>


--
mailmetoday is a free e-mail service from India Today Group Online that also rewards 
you with cool gifts. Sign up now at http://www.mailmetoday.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to