Hi, I am looking for an example using org.apache.commons.dbcp.BasicDataSource and more over, I cant use a .war file to deploy my app (there are some problems)
Uma -----Original Message----- From: Amleto Di Salle [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 4:29 PM To: 'Struts Users Mailing List' Subject: R: Connection Pool best practice Hi, In order to use JNDI you can do the following steps: 1) create a context.xml file inside the meta-inf directory inside your war file: <Context path="/YourApplication"> <Resource name="jdbc/Database" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/DataBase"> <parameter> <name>maxWait</name> <value>5000</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>password</name> <value>manager</value> </parameter> <parameter> <name>url</name> <value>jdbc:oracle:thin:@127.0.0.1:1521:OracleDB</value> </parameter> <parameter> <name>driverClassName</name> <value>oracle.jdbc.driver.OracleDriver</value> </parameter> <parameter> <name>maxIdle</name> <value>20</value> </parameter> <parameter> <name>username</name> <value>system</value> </parameter> </ResourceParams> </Context> 2) inside your application use the following code: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource dataSource = (DataSource) envCtx.lookup("jdbc/DataBase"); To obtain a DataSource BR /amleto > -----Messaggio originale----- > Da: Vamsee Kanakala [mailto:[EMAIL PROTECTED] > Inviato: mercoledì 19 gennaio 2005 11.42 > A: Struts Users Mailing List > Oggetto: Re: Connection Pool best practice > > > Kalluru Uma. Maheswar wrote: > > >Hi, > > > >I am using org.apache.commons.dbcp.BasicDataSource to implement a > >connection pooling and this is my class. > > > > > If you're using Tomcat, you're better-off using JNDI Datasource: > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples -howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations Vamsee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.7.0 - Release Date: 17/01/2005 --------------------------------------------------------------------- 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]