On Thu, 14 Mar 2002, Mark Muffett wrote:

> Date: Thu, 14 Mar 2002 09:18:13 -0000
> From: Mark Muffett <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: Re: jndi versus database connection pooling
>
> There's a lot to configure to get it to work.
>
> The coding side seems to be well documented, and there have been several
> instances posted here, but (as far as I can see) we're all working in the
> dark with server.xml.  I've spent a lot of time trying to get database
> pooling to work with Postgresql, but I've failed and given up.  I'd be
> interested to know what database/tomcat configurations anyone has got to
> work - with some sample server.xml fragments if possible.
>

I use the JNDI based connection pool with Postgres quite successfully.
You will need to have postgresql.jar in $CATALINA_HOME/common/lib, and a
server.xml configuration something like this:

  <Context path="/foo" ...>

    <Resource name="jdbc/EmployeeDB" auth="Container"
              type="javax.sql.DataSource">
    <ResourceParams name="jdbc/EmployeeDB">
      <parameter>
        <name>driverClassName</name>
        <value>org.postgresql.Driver</value>
      </parameter>
      <parameter>
        <name>driverName</name>
        <value>jdbc:postgresql://localhost/dbname</value>
      </parameter>
      <parameter>
        <name>passwod</name>
        <value>dbpassword</value>
      </parameter>
      <parameter>
        <name>user</name>
        <value>dbusername</value>
      </parameter>
    </ResourceParams>

  </Context>

where "dbname" is the name of your database, and "dbusername" and
"dbpassword" are the username and password needed to connect.  The rest of
the stuff in the JNDI Resources HOW-TO documentation for accessing this
data source from your application is the same.

One Postgres-specific note is that you have to start the "postmaster"
application listening for TCP socket connections (defaults to port 5432),
as described in the Postgres docs.  But you would have found that out
already if you tried a small test program that opened the database
directly (invaluable to make sure that you've got all the database
parameters set up right).

> Mark
>

Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to