If you are using Tomcat, I believe you can change it in the
C:\jakarta-tomcat-5.0.xx\conf\server.xml file. Something like this:
Tom Kochanowicz
<!--
Configure Classified Ads JNDI Datasource
connection.
Example:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples
-howto.html
-->
<Context path="/classified" docBase="classified"
debug="5" reloadable="true" crossContext="true">
<Logger
className="org.apache.catalina.logger.FileLogger"
prefix="localhost_Classifieds_log."
suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/Classifieds"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/Classifieds">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in
pool. Make sure you
configure your mysqld max_connections
large enough to handle
all of your db connections. Set to 0
for no limit.
-->
<parameter>
<name>maxActive</name>
<value>25</value>
</parameter>
<!-- Maximum number of idle dB
connections to retain in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>15</value>
</parameter>
<!-- Maximum time to wait for a dB
connection to become available
in ms, in this example 10 seconds. An
Exception is thrown if
this timeout is exceeded. Set to -1 to
wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- To configure a DBCP DataSource so
that abandoned dB connections
are removed and recycled
-->
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<!-- MySQL dB username and password for
dB connections -->
<parameter>
<name>username</name>
<value>tom</value>
</parameter>
<parameter>
<name>password</name>
<value>donttell</value>
</parameter>
<!-- Class name for mm.mysql JDBC driver
-->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for
connecting to your MySQL dB.
The autoReconnect=true argument to the
url makes sure that the
mm.mysql JDBC Driver will automatically
reconnect if mysqld closed the
connection. mysqld by default closes
idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/Classifieds?autoReconnect=true</value
>
</parameter>
</ResourceParams>
</Context>
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED] On Behalf Of Jack
Lauman
Sent: Sunday, August 29, 2004 4:23 PM
To: [EMAIL PROTECTED]
Subject: DataSource Question
I'm using the following code in a servlet to get a JDBC connection:
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DBNameDS");
Connection conn = ds.getConnection();
It works fine... but I would like to be able to substitute "DBNameDS"
with the actual name of the ds as defined in the web.xml file.
How can this be done?
Jack
________________________________________________________________________
___
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 8/16/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 8/16/2004
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html