Thanks Doug!

For the rest of us, here are the steps I used to
resolve this, per Doug's info:

First I was missing some very important posgresql
configuration steps.

These can be found here:
http://www.fankhausers.com/postgresql/jdbc/

Summary:
- Needed to enable tcp/ip connection to the database
  located in var/lib/pgsql/data/postresql.conf
- Needed to allow access to the database (pg_hba.conf)

After this I left server.xml in its original state (as
it comes with tomcat) and put the application context
descriptor containing the connection pool in
$CATALINA_HOME/conf/Catalina/localhost

and ..... IT WORKS!!!!

Thanks again,
- Ole 

--- Parsons Technical Services
<[EMAIL PROTECTED]> wrote:

> Your update to the server.xml must be one of two
> way.
> 
> Declare it in a context tag set or in a
> GlobalResource tag set.
> 
> If done in a GlobalResource then a ResourceLink is
> also needed.
> 
> If you don't declare your context in the server.xml,
> you can declare your 
> resource in your context tag that resides in your
> app. This will make it 
> available to your app only.
> 
> I think there is a typo on the page. I believe that
> it must be declared 
> inside a context pair. The page text lead one to
> think it only has to be 
> inside the host tags.
> 
>
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
> 
> Doug
> 
> ----- Original Message ----- 
> From: "Ole Ersoy" <[EMAIL PROTECTED]>
> To: "Tomcat Users List"
> <[email protected]>
> Sent: Friday, March 04, 2005 9:45 AM
> Subject: Re: Tomcat 5.5.8 Postgresql 7.4.6 No
> suitable driver exception
> 
> 
> > Sorry - wrong wget lines - I meant to provide this
> > statement:
> > wget
> >
>
http://jdbc.postgresql.org/download/pg74.215.jdbc2.jar
> >
> > I then untarred it in the common lib directory.  I
> > tried both the type 2 and type 3 driver.
> >
> > Thanks,
> > - Ole
> > --- Ole Ersoy <[EMAIL PROTECTED]> wrote:
> >
> >> David,
> >>
> >> I downloaded it and un-zipped it here:
> >>
> >> > cd /usr/local/jakarta-tomcat-5.5.7/common/lib
> >> >- wget
> >>
>
>>http://cvs.apache.org/builds/jakarta-taglibs/nightly/jakarta-taglibs-20050303.tar.gz
> >> >- tar xzf jakarta-taglibs-20050303.tar.gz
> >>
> >> I've tried both type two and type 3 drivers,
> since
> >> the
> >> example was a bit vague on which driver is
> currently
> >> supported by DBCP.
> >>
> >> Thanks though,
> >> - Ole
> >> --- David Smith <[EMAIL PROTECTED]> wrote:
> >>
> >> > One of the only things I don't see here -- and
> >> it's
> >> > a big one -- no
> >> > postgresql jdbc driver in common/lib.  Tomcat
> >> > doesn't come with it by
> >> > default.  You have to download the latest and
> >> > install it before this
> >> > will work.
> >> >
> >> > --David
> >> >
> >> > Ole Ersoy wrote:
> >> >
> >> > >Hi everybody,
> >> > >
> >> > >I'm attempting to get the JNDI Datasource How
> To
> >> > >example for Postgresql to work.
> >> > >
> >> > >Here is the URL for the example:
> >> >
> >>
>
>>http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> >> > >
> >> > >After completing the listed steps the test.jsp
> >> > error
> >> > >page reports:
> >> > >"java.sql.SQLException: No suitable driver"
> >> > >
> >> > >Here are all my configuration steps, including
> >> the
> >> > >files:
> >> > >- On Fedora Core 3 - adduser postgres
> >> > >- passwd postgres (set to postgres)
> >> > >- chown postgres /var/lib/pqsql/data
> >> > >- /usr/bin/initdb -D /var/lib/pgsql/data
> >> > >- /usr/bin/postmaster -D /var/lib/pgsql/data
> >> > >logfile
> >> > >2>&1 &
> >> > >- createdb test postgres
> >> > >- psql test
> >> > >create table testdata (id int not null primary
> >> key,
> >> > >foo varchar(25), bar int);
> >> > >insert into testdata values(1, 'hello',
> 12345);
> >> > >- Update server.xml with this under the
> </Host>
> >> > tag:
> >> > ><Resource name="jdbc/postgres"
> auth="Container"
> >> > >          type="javax.sql.DataSource"
> >> > >driverClassName="org.postgresql.Driver"
> >> > >
> >> > url="jdbc:postgresql://127.0.0.1:5432/mydb"
> >> > >          username="postgres"
> password="postgres"
> >> > >maxActive="20" maxIdle="10" maxWait="-1"/>
> >> > ></Context>
> >> > > cd /usr/local/jakarta-tomcat-5.5.7/common/lib
> >> > >- wget
> >> >
> >>
>
>>http://cvs.apache.org/builds/jakarta-taglibs/nightly/jakarta-taglibs-20050303.tar.gz
> >> > >- tar xzf jakarta-taglibs-20050303.tar.gz
> >> > >- mkdir /var/www/webapps/dbtest
> >> > >- vi /var/www/webapps/dbtest/test.jsp (I put
> the
> >> > >example code here)
> >> > >Here it is just in case:
> >> > >
> >> > >
> >> > ><%@ taglib
> uri="http://java.sun.com/jsp/jstl/sql";
> >> > >prefix="sql" %>
> >> > ><%@ taglib
> >> uri="http://java.sun.com/jsp/jstl/core";
> >> > >prefix="c" %>
> >> > >
> >> > ><sql:query var="rs" dataSource="jdbc/TestDB">
> >> > >select id, foo, bar from testdata
> >> > ></sql:query>
> >> > >
> >> > ><html>
> >> > >  <head>
> >> > >    <title>DB Test</title>
> >> > >  </head>
> >> > >  <body>
> >> > >
> >> > >  <h2>Results</h2>
> >> > >
> >> > ><c:forEach var="row" items="${rs.rows}">
> >> > >    Foo ${row.foo}<br/>
> >> > >    Bar ${row.bar}<br/>
> >> > ></c:forEach>
> >> > >
> >> > >  </body>
> >> > ></html>
> >> > >
> >> > >- mkdir /var/www/webapps/dbtest/WEB-INF/
> >> > >- vi /var/www/webapps/dbtest/WEB-INF/web.xml
> >> > >
> >> > >I have the following in web.xml
> >> > ><web-app
> xmlns="http://java.sun.com/xml/ns/j2ee";
> >> > >
> >> >
> >>
>
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >> > >
> >> >
> >>
> >xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> >> >
> >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
> >> > >    version="2.4">
> >> > >  <description>Postgre Test App</description>
> >> > >  <resource-ref>
> >> > >      <description>DB Connection</description>
> >> > >      <res-ref-name>jdbc/test</res-ref-name>
> >> > >     
> <res-type>javax.sql.DataSource</res-type>
> >> > >      <res-auth>Container</res-auth>
> >> > >  </resource-ref>
> >> > ></web-app>
> >> > >
> >> > >I now copy the necessary tag libraries over to
> >> the
> >> > >application directory:
> >> > >- mkdir /var/www/webapps/dbtest/WEB-INF/lib
> >> > >- cp
> >> >
> >>
> 
=== message truncated ===



        
                
__________________________________ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to