Hi,
for those who followed this thread I just wanted to post the solution
that worked for me.
In my server.xml I configured my context the following way:
<Context path="/axis" docBase="axis" debug="0">
<Resource name="jdbc/auctionDB" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/auctionDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<value>yourUsername</value>
</parameter>
<parameter>
<name>password</name>
<value>yourPassword</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value></parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/timeslotauction?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
In my web.xml:
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>
jdbc/auctionDB
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
And then on the webpage:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/auctionDB");
OR
Context initCtx = new InitialContext();
DataSource ds =
(DataSource)initCtx.lookup("java:comp/env/jdbc/auctionDB");
Thanks for the help
Jens
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>
- JNDI Data Source Jens K�hnberger
- Re: JNDI Data Source Lindomar
- Re: JNDI Data Source Jacob Kjome
- Re: JNDI Data Source Jens Kühnberger
- Re: JNDI Data Source Leo Przybylski
- Re: JNDI Data Source Przemyslaw Korona
- JNDI Data Source Jens K�hnberger
- Re: JNDI Data Source Mehdi . Nejad
- Re: JNDI Data Source Przemyslaw Korona
- Re: JNDI Data Source - my fault Przemyslaw Korona
