tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Connection to data source
Date Thu, 16 Sep 2004 12:24:46 GMT

Hi,
Where in server.xml is the Resource tag located?

Yoav Shapira
Millennium Research Informatics


>-----Original Message-----
>From: LINGALA, AMARESHWAR G (SBCSI) [mailto:al3495@sbc.com]
>Sent: Wednesday, September 15, 2004 3:27 PM
>To: Tomcat Users List
>Subject: RE: Connection to data source
>
>
> 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:myschema@127.0.0.1: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:Yoav.Shapira@mpi.com]
>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:al3495@sbc.com]
>>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-exampl
e
>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(BasicDataSour
c
>e
>>.java:780)
>>	at
>>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.
j
>a
>>va:540)
>>	at
>>com.sbc.ssbilling.database.DBConnectionImpl.makeDBConnection(DBConnect
i
>o
>>nImpl.java:63)
>>	at
>>com.sbc.ssbilling.calculation.action.CalculationsReportAction.execute(
C
>a
>>lculationsReportAction.java:49)
>>	at
>>org.apache.struts.action.RequestProcessor.processActionPerform(Request
P
>r
>>ocessor.java:484)
>>	at
>>org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav
a
>:
>>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(Appli
c
>a
>>tionFilterChain.java:237)
>>	at
>>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFi
l
>t
>>erChain.java:157)
>>	at
>>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperVa
l
>v
>>e.java:214)
>>	at
>>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
C
>o
>>ntext.java:104)
>>	at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:
>5
>>20)
>>	at
>>org.apache.catalina.core.StandardContextValve.invokeInternal(StandardC
o
>n
>>textValve.java:198)
>>	at
>>org.apache.catalina.core.StandardContextValve.invoke(StandardContextVa
l
>v
>>e.java:152)
>>	at
>>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
C
>o
>>ntext.java:104)
>>	at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:
>5
>>20)
>>	at
>>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.ja
v
>a
>>:137)
>>	at
>>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
C
>o
>>ntext.java:104)
>>	at
>>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.ja
v
>a
>>:117)
>>	at
>>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
C
>o
>>ntext.java:102)
>>	at
>>org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java
:
>5
>>20)
>>	at
>>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValv
e
>.
>>java:109)
>>	at
>>org.apache.catalina.core.StandardValveContext.invokeNext(StandardValve
C
>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.proces
s
>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(ThreadPo
o
>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(BasicDataSour
c
>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: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>
>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: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message