Josh,
Got you covered.
Warning this email may be long winded, so take breaks often.
First, unless there is a reason for you NOT to have a context then this will
get you going.
First in the server.xml set up a GlobalResource such as this:
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource name="jdbc/GolfDB" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/GolfDB">
<parameter>
<name>validationQuery</name>
<value>select 1</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/golf?autoReconnect=true</value>
</parameter>
<parameter>
<name>password</name>
<value>******</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>username</name>
<value>******</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
Of course replace the necesary data with your specifics.
Next place this, at the bottom, in your web.xml for the app:
<resource-ref>
<description>GolfDB Connection</description>
<res-ref-name>jdbc/GolfDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Now create a file in the META-INF directory. Name the file context.xml.
In this file you will need to define the context and the link to the jdbc.
<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="golf" docBase="golf"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/golf"
privileged="false" reloadable="false" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">
<ResourceLink name="jdbc/GolfDB" global="jdbc/GolfDB"
type="javax.sql.DataSource"/>
</Context>
My application is deployed with the manager from a war file named golf.war
The resource name is jdbc/GolfDB and I am running against a MySQL database.
Make sure all the names match exactly as this will cause many bumps from
banging you head. Adjust other setting to match your needs.
I am on TAO linux, Tomcat 5.0.19 And JVM 1.4.2_04-b05.
Good luck and let us know.
Doug
www.parsonstechnical.com
----- Original Message -----
From: "Josh G" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 25, 2004 6:39 PM
Subject: jndi without a <context>??
> Hi, I don't have a <context> element in my server.xml or my web xml, and
as
> such I can't seem to make dbcp work...
>
> I know that in tomcat5 you can put this information in the web.xml, but I
> sure as hell can't find out how, anybody can point me in the right
direction?
>
> Cheers,
> -Josh
>
>
> "My Ferrari! I had to do awful things to pay for her!"
>
> [ Josh 'G' McDonald ] -- [ Pirion Systems, Brisbane]
>
> [ 07 3257 0490 ] -- [ 0415 784 825 ] -- [ http://www.gfunk007.com/ ]
>
>
> ---------------------------------------------------------------------
> 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]