Below are the modifications made

1. Server.xml
        <Resource name="jdbc/myoracle" auth="Container"
              type="javax.sql.DataSource"/> 

        <ResourceParams name="jdbc/myoracle">
          <parameter>
            <name>factory</name>
        
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
          </parameter>
          <parameter>
            <name>driverClassName</name>
            <value>oracle.jdbc.driver.OracleDriver</value>
          </parameter>
          <parameter>
            <name>url</name>
        
<!--value>jdbc:oracle:thin:[EMAIL PROTECTED]:1521:mysid</value-->
        
<value>jdbc:oracle:thin:@chd4.sbc.com:1521:ostl411</value>
          </parameter>
          <parameter>
            <name>username</name>
                <value>user</value>
          </parameter>
          <parameter>
            <name>password</name>
            <value>pass</value>
          </parameter>
          <parameter>
            <name>maxActive</name>
            <value>20</value>
          </parameter>
          <parameter>
            <name>maxIdle</name>
            <value>10</value>
          </parameter>
          <parameter>
            <name>maxWait</name>
            <value>-1</value>
          </parameter>
        </ResourceParams>


2. Web.xml
        <resource-ref>
                 <description>Oracle Datasource example</description>
                 <res-ref-name>jdbc/myoracle</res-ref-name>
                 <res-type>javax.sql.DataSource</res-type>
                 <res-auth>Container</res-auth>
        </resource-ref> 

3. Code
         Context initContext = new InitialContext();
         Context envContext  =
(Context)initContext.lookup("java:/comp/env");
         DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
         //Connection conn = ds.getConnection();
         con = ds.getConnection();


 Thanks for the Help

-----Original Message-----
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 15, 2004 2:15 PM
To: Tomcat Users List
Subject: RE: Connection to data source



Hi,
Please post the relevant parts of your server.xml, web.xml, and code
using the DataSource, and maybe we can help you more.

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: LINGALA, AMARESHWAR G (SBCSI) [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, September 15, 2004 3:10 PM
>To: Tomcat Users List
>Subject: Connection to data source
>
>
> Hi,
>     I am trying to Implement Connection Pooling to my web application.
>I have followed Instructions from
>http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-example
s
>-howto.html
>
> I have included code into server.xml of tomcat and also made changes
to
>web.xml of the application. But whenever I try to connect to the
>database I get the following error.
>
>org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of
>class '' for connect URL 'null'
>       at
>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSourc
e
>.java:780)
>       at
>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j
a
>va:540)
>       at
>com.sbc.ssbilling.database.DBConnectionImpl.makeDBConnection(DBConnecti
o
>nImpl.java:63)
>       at
>com.sbc.ssbilling.calculation.action.CalculationsReportAction.execute(C
a
>lculationsReportAction.java:49)
>       at
>org.apache.struts.action.RequestProcessor.processActionPerform(RequestP
r
>ocessor.java:484)
>       at
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java
:
>274)
>       at
>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
>       at
>org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>       at
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applic
a
>tionFilterChain.java:237)
>       at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFil
t
>erChain.java:157)
>       at
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVal
v
>e.java:214)
>       at
>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
o
>ntext.java:104)
>       at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
5
>20)
>       at
>org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCo
n
>textValve.java:198)
>       at
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextVal
v
>e.java:152)
>       at
>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
o
>ntext.java:104)
>       at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
5
>20)
>       at
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.jav
a
>:137)
>       at
>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
o
>ntext.java:104)
>       at
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.jav
a
>:117)
>       at
>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
o
>ntext.java:102)
>       at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
5
>20)
>       at
>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve
.
>java:109)
>       at
>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveC
o
>ntext.java:104)
>       at
>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
5
>20)
>       at
>org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
>       at
>org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
>       at
>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:7
9
>9)
>       at
>org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process
C
>onnection(Http11Protocol.java:705)
>       at
>org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:5
7
>7)
>       at
>org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPoo
l
>.java:683)
>       at java.lang.Thread.run(Thread.java:534)
>Caused by: java.sql.SQLException: No suitable driver
>       at java.sql.DriverManager.getDriver(DriverManager.java:243)
>       at
>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSourc
e
>.java:773)
>       ... 33 more
>
>
> Please let me know if anything else needs to be changes too.
>
> Any help Is greatly appreciated.
>
> Amar
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential,
proprietary and/or privileged.  This e-mail is intended only for the
individual(s) to whom it is addressed, and may not be saved, copied,
printed, disclosed or used by anyone else.  If you are not the(an)
intended recipient, please immediately delete this e-mail from your
computer system and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to