commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Garth Keesler <gar...@gdcjk.com>
Subject TC 5.5.20 Config
Date Sat, 20 Jan 2007 18:47:26 GMT
According to this website:

http://wiki.apache.org/tomcat/UsingDataSources

All I have to do is add a context.xml file like this to the web service:

<?xml version="1.0" encoding="UTF-8"?>

<Context>

    <Resource name="jdbc/MyDB" auth="Container" type="javax.sql.DataSource"
              username="user" password="password"
          url="jdbc:postgresql://pgsrv:5432/TTNA"
              factory="org.apache.commons.dbcp.BasicDataSourceFactory"
              driverClassName="org.postgresql.Driver"
              maxActive="20" maxIdle="10"/>

</Context>

And a few changes to the java that connects like this:

        InitialContext ic = new InitialContext();
        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/MyDB");
        Connection db = ds.getConnection();

and all ought to work great. Unfortunately, like most other examples out 
there, it probably assumes more knowledge on the part of the noob trying 
it for the first time than it should.

What I see is when all should work is this:

Sat Jan 20 12:15:36 CST 2007 - exception returned from call to Vendor: e 
= java.lang.RuntimeException: Error in Vendor.Save: 
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

There are plenty of discussions about this particular error on the web 
but most of them indicate that other xml files need to be modified as 
well, like server.xml and web.xml.

Any help greatly appreciated...

Thanx,
Garth


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message