tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tangy Verdell" <ta...@gardell.com>
Subject jndi datasource resolution
Date Fri, 09 Nov 2001 16:19:09 GMT
I couldn't use jndi to get my jdbc datasource working with TomcCat 4.01. I went to this mailing
list and found no help. I did see a lot of people with my same problem.

The datasource is null.

To fix it, I had to create a context for my application in my server.xml file. In the JNDI
HOW-TO, it specifies you can put your resource configuration within the context parameters.
However, you also have to put it in the context of your application. This is something that
newbies like myself didn't know. Here is an example of my configuration. Hope this saves someone
some time.



 <Context path="/postgresql" docBase="postgresql"
         debug="0" privileged="true">

<Resource name="jdbc/ajug" auth="Container"

            type="javax.sql.DataSource"/>

  <ResourceParams name="jdbc/ajug">

    <parameter>

      <name>user</name>

      <value>postgres</value>

    </parameter>

    <parameter>

      <name>password</name>

      <value>postgres</value>

    </parameter>

    <parameter>

      <name>driverClassName</name>

      <value>org.postgresql.Driver</value>

    </parameter>

    <parameter>

      <name>driverName</name>

      <value>jdbc:postgresql://192.168.1.1/ajug</value>

    </parameter>

  </ResourceParams>


        </Context>
==============
Tangy Verdell
tangy@gardell.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message