You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Eric Wulff <ew...@gmail.com> on 2004/11/05 04:46:30 UTC

Re: connection pooling

Hi all, I'm returning to a problem I couldn't solve the first time,
about two months ago, and still can't seem to figure out.  I can't get
a db connection using connection pools.  I get the exception listed
below, same as so many have previously, but nothing I've found seems
to works.  Below are my specs.  Anyone with concrete advise/direction
on how to get
this working?

Also, I noticed in many solutions the suggestion was made to edit the
myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. 
However, there is no myapp.xml in that directory on my server. Just 2
.xml's related to other applications and a manager.xml which I'm not
sure what it's related to.

OS: FC2
Tomcat 5.0.28

exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
JDBC driver class '' for connect URL 'null'

WEB-INF web xml: code inserted AFTER all servlet mappings...
	<resource-ref>
		<res-ref-name>jdbc/wms</res-ref-name>
		<res-type>javax.sql.DataSource</res-type>
		<res-auth>Container</res-auth>
	</resource-ref>

server xml(tried this with and without a Resource name)...
<Context path="/wms" docBase="wms" debug="0" reloadable="true">
    <ResourceParams name="jdbc/wms">
      <parameter>
        <name>username</name>
        <value>whatever</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>whatever</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.informix.jdbc.IfxDriver</value>
      </parameter>
	  <parameter>
	 	<name>url</name>
	<value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
	</parameter>
    </ResourceParams>
  </Context>

I have the following jars in my <CATALINA_HONE>/common/lib and I also
tried putting the db driver and commons-collections, dbcp, and pool in
my WEB-INF/lib with no success.  They are all mode 644.

ant.jar
ant-launcher.jar
commons-collections-3.1.jar
commons-dbcp-1.2.1.jar
commons-el.jar
commons-pool-1.2.jar
ifxjdbc.jar (the necessary informix driver)
jar.txt
jasper-compiler.jar
jasper-runtime.jar
jsp-api.jar
mysql-connector-java-3.0.15-ga-bin.jar
naming-common.jar
naming-factory.jar
naming-java.jar
naming-resources.jar
servlet-api.jar



On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
<at...@gmail.com> wrote:
> hi,
>  i am not sure but you may try downloading latest jar files for
> following froom tomcat site and try them out. copy the old jar files
> somewhere else and try using the latest jar files.
> 1) Commons Collections
> 2)Commons DBCP
> 3)Commons Pool
> 
> 
> 
> 
> On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > Except that the driver works for connecting if I'm not utilizing a
> > connection pool, i.e., I am able to connect to the db and manipulate
> > data via DriverManager.getConnection(url, db, pwd).
> >
> > The driver is located in CATALINA_HOME/commons/lib
> >
> > Eric
> >
> > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > <ph...@shareowner.com> wrote:
> > > No, you don't need that many params. I think your problem might be the
> >
> >
> > > driver. Where did you drop off your informix jdbc jar?
> > >
> > >
> > > -----Original Message-----
> > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > Sent: October 7, 2004 5:56 PM
> > > To: Tomcat Users List
> > > Subject: Re: connection pooling
> > >
> > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > suggest adding many parameters.  Are they necessary for simply making a
> > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
> > > your suggestions out.
> > > Including the <Resource> tag, but that seems critical for connection.
> > >
> > > Eric
> > >
> > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin <ph...@shareowner.com>
> > > wrote:
> > > > 1. web.xml: OK
> > > >
> > > > 2. context.xml on <context> of server.xml:
> > > >
> > > >         <Resource name="jdbc/test_connect" auth="Container"
> > > > type="javax.sql.DataSource"/> <= have you added this?
> > > >         <ResourceParams name="jdbc/test_connect">
> > > >         <parameter>
> > > >                 <name>driverClassName</name>
> > > >                 <value>your.jdbc.driver</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>url</name>
> > > >                 <value>your.jdbc.url</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>username</name>
> > > >                 <value>youruser</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>password</name>
> > > >                 <value>yourpass</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>maxActive</name>
> > > >                 <value>20</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>maxIdle</name>
> > > >                 <value>10</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>minIdle</name>
> > > >                 <value>10</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>maxWait</name>
> > > >                 <value>15000</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>removeAbandoned</name>
> > > >                 <value>true</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>validationQuery</name>
> > > >                 <value>your_query</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>testOnBorrow</name>
> > > >                 <value>true</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>testOnReturn</name>
> > > >                 <value>true</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>minEvictableIdleTimeMillis</name>
> > > >                 <value>-1</value>
> > > >         </parameter>
> > > >         <!-- sleeps 5 minutes -->
> > > >         <parameter>
> > > >                 <name>timeBetweenEvictionRunsMillis</name>
> > > >                 <value>300000</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>numTestsPerEvictionRun</name>
> > > >                 <value>1</value>
> > > >         </parameter>
> > > >         <parameter>
> > > >                 <name>testWhileIdle</name>
> > > >                 <value>true</value>
> > > >         </parameter>
> > > >
> > > >         </ResourceParams>
> > > >
> > > > 3. code
> > > >
> > > >                 Context initContext = new InitialContext();
> > > >                 Context jdbcContext = (Context)
> > > > initContext.lookup("java:comp/env");
> > > >                 DataSource dataSource = (DataSource)
> > > > jdbcContext.lookup("jdbc/test_connect");
> > > >                 ...
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > Sent: October 7, 2004 4:34 PM
> > > > To: Tomcat Users List
> > > > Subject: Re: connection pooling
> > > >
> > > > Hi Phillip,
> > > >
> > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > Detail, detail, detail.
> > > > >
> > > > > 1. your context.xml
> > > > > 2. your web.xml
> > > > > 3. how do you obtain connection from pool, java code pls. 4. can you
> > > > > connect using pool 5. commons-pool version
> > > > >
> > > > > Etc. etc.
> > > > >
> > > > > You need to provide details otherwise we can't help.
> > > >
> > > > This was all included in my original post.  Ok, actually my 2nd post
> > > > because I accidentally hit send prior to completing my post via the
> > > > scroll pad on my laptop.  Still, thx for checking on this and the info
> > > > you looking for is copied again here...
> > > >
> > > > System:
> > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > Server 9.4 on Windows Server
> > > >
> > > > -I am able to connect to my db via typical JDBC
> > > > DriverManager.getConnection().  This leads me to believe that my
> > > > informix jdbc driver is in the correct place...
> > > > CATALINA_HOME/common/lib -I have a Context set up in my server.xml per
> > > > examples in a text tutorial I'm referencing
> > > >
> > > > Below listed...
> > > > -errors
> > > > -web.xml
> > > > -server.xml <Context> (minus connection actual values)
> > > > -.java
> > > >
> > > > exception/errors:
> > > > -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > JDBC driver of class '' for connect URL 'null' SQL state: null Error
> > > > code: 0
> > > >
> > > > -stack trace reveals this, but I can't see why since I have the driver
> > > > in the correct directory...
> > > > java.sql.SQLException: No suitable driver at
> > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > ce.jav
> > > > a:773)
> > > >
> > > > web.xml:
> > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > <!DOCTYPE web-app
> > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > <web-app>
> > > >        <servlet>
> > > >                <servlet-name>Test Connection Pooling</servlet-name>
> > > >                <servlet-class>TestConnectionPooling</servlet-class>
> > > >        </servlet>
> > > >
> > > >        <servlet-mapping>
> > > >                <servlet-name>Test Connection Pooling</servlet-name>
> > > >                <url-pattern>/testConnectionPooling</url-pattern>
> > > >        </servlet-mapping>
> > > >
> > > >        <resource-ref>
> > > >          <res-ref-name>jdbc/test_connect</res-ref-name>
> > > >          <res-type>javax.sql.DataSource</res-type>
> > > >          <res-auth>Container</res-auth>
> > > >        </resource-ref>
> > > > </web-app>
> > > >
> > > > server.xml <Context>:
> > > >  <Context path="/testConnectionPooling"
> > > > docBase="testConnectionPooling" debug="0" reloadable="true">
> > > >    <ResourceParams name="jdbc/test_connect">
> > > >      <parameter>
> > > >        <name>username</name>
> > > >        <value>informix</value>
> > > >      </parameter>
> > > >      <parameter>
> > > >        <name>password</name>
> > > >        <value>informix</value>
> > > >      </parameter>
> > > >      <parameter>
> > > >        <name>driverClassName</name>
> > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > >      </parameter>
> > > >      <parameter>
> > > >        <name>url</name>
> > > > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > /value
> > > > >
> > > >      </parameter>
> > > >    </ResourceParams>
> > > >  </Context>
> > > >
> > > > .java:
> > > > import java.io.*;
> > > > import java.sql.*;
> > > > // -Must import javax.naming use JNDI which is required to implement data
> > > > //   resource references and hence connection pooling.
> > > > import javax.naming.*;
> > > > import javax.sql.*;
> > > > import javax.servlet.*;
> > > > import javax.servlet.http.*;
> > > > import java.util.*;
> > > >
> > > > public class TestConnectionPooling extends HttpServlet {
> > > >        private DataSource dataSource;
> > > >
> > > >        public void init(ServletConfig config) throws ServletException {
> > > >                try {
> > > >                        Context init = new InitialContext();
> > > >                        // don't know what the 'java:comp/env' refers to
> > > >                        Context ctx = (Context)
> > > init.lookup("java:comp/env");
> > > >                        // I know "jdbc/conversion must match the
> > > > web.xml res-ref-name of the web.xml but don't know what the path really
> > > refers to
> > > >                        dataSource = (DataSource)
> > > > ctx.lookup("jdbc/test_connect");
> > > >                } catch (NamingException ex) {
> > > >                        throw new ServletException("Cannot retrieve
> > > > java:comp/env/jdbc/test_connect",ex);
> > > >                }
> > > >        }
> > > >
> > > >        public void doGet(HttpServletRequest request,
> > > > HttpServletResponse
> > > > response)
> > > >        throws ServletException, IOException {
> > > >                response.setContentType("text/html");
> > > >                PrintWriter out = response.getWriter();
> > > >                Connection connection = null;
> > > >                out.println ("<HTML><HEAD><TITLE>Test Connection
> > > > Pooling</TITLE></HEAD><BODY>");
> > > >                out.println("<H1>Customer Name Query</H1>");
> > > >
> > > >                try {
> > > >                        synchronized(dataSource) {
> > > >                            connection = dataSource.getConnection();
> > > >                        }
> > > >                        out.println("<br>");
> > > >                        out.println("<strong>Loaded informix driver
> > > > successfully via server.xml.</strong>" +
> > > >                                                "Now attempting db
> > > > connection.");
> > > >                        out.println("<br>");
> > > >                        PreparedStatement pstmt =
> > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > >                        ResultSet results = pstmt.executeQuery();
> > > >                        if (!results.next()) {
> > > >                                throw new SQLException("No data
> > > > returned for some reason");
> > > >                        }
> > > >                        out.println("<br>");
> > > >                        while(results.next()) {
> > > >                                out.println("<tr><td>" +
> > > > results.getString("blah") + "</td></tr>");
> > > >                        }
> > > >        } catch (Exception ex) {
> > > >                        out.println("<br>");
> > > >                        out.println("Exception: " + ex);
> > > >                        if(ex instanceof SQLException) {
> > > >                                SQLException sqlex = (SQLException) ex;
> > > >                                out.println("<br>");
> > > >                                out.println("SQL state:
> > > > "+sqlex.getSQLState()+"<BR>");
> > > >                                out.println("<br>");
> > > >                                out.println("Error code:
> > > > "+sqlex.getErrorCode()+"<BR>");
> > > >                                out.println("<br><br>");
> > > >                                sqlex.printStackTrace(out);
> > > >                                out.println("<br><br>");
> > > >                        }
> > > >        }
> > > >        finally {
> > > >            try { connection.close(); } catch (Exception ex) {}
> > > >        }
> > > >                out.println ("</BODY></HTML>");
> > > >    }
> > > > }
> > > >
> > > >   ReplyForward
> > > >
> > > > jthompson@honda.co.nz
> > > > java code: Context ctx = (Context) init.lookup("xxxxxx"); server.xml:
> > > > <Resour...
> > > >                  Oct 6 (22 hours ago)
> > > >
> > > > jthompson@honda.co.nz
> > > > Please ignore my last post - it's wrong. (Answered before verifying).
> > > >                  Oct 6 (22 hours ago)
> > > >
> > > > jthompson@honda.co.nz
> > > > Is that litterally what you have in your server.xml?
> > > >                  Oct 6 (22 hours ago)
> > > >
> > > > Eric Wulff
> > > > No, literally I have the actual values. The same connection string I
> > > > use to s...
> > > >                  Oct 6 (22 hours ago)
> > > >
> > > > jthompson@honda.co.nz
> > > > Is there a xxxxx.xml file in (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > where xxx...
> > > >                  Oct 6 (22 hours ago)
> > > >
> > > > Eric Wulff
> > > > Context name? I assume your referring to the ResourceParams name
> > > > attribute, j...
> > > >                  Oct 6 (19 hours ago)
> > > >
> > > > Phillip Qin
> > > > <ph...@shareowner.com> to Tomcat
> > > >          More options    6:29am (7 hours ago)
> > > > Detail, detail, detail.
> > > >
> > > > 1. your context.xml
> > > > 2. your web.xml
> > > > 3. how do you obtain connection from pool, java code pls.
> > > > 4. can you connect using pool
> > > > 5. commons-pool version
> > > >
> > > > Etc. etc.
> > > >
> > > > You need to provide details otherwise we can't help.
> > > > - Show quoted text -
> > > >
> > > > -----Original Message-----
> > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > Sent: October 6, 2004 5:09 PM
> > > > To: tomcat-user@jakarta.apache.org
> > > > Subject: connection pooling
> > > >
> > > > Hi all, I have gone over some of the tomcat docs and googled errors
> > > > but there is SO much information covering JNDI and Datasources... and
> > > > I'm hoping I don't have to be a JNDI/Datasource and XML guru just to
> > > > set up db connections via connection pool.
> > > >
> > > > My situation is this...
> > > >
> > > > System:
> > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > Server 9.4 on Windows Server
> > > >
> > > > -I am able to connect to my db via typical JDBC
> > > > DriverManager.getConnection(). -This leads me to believe that my jdbc
> > > > driver is in the correct place ...CATALINA
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > >
> > > >
> > > >   ReplyForwardInvite Phillip to Gmail
> > > > Send  Save Draft  Discard      Check spelling
> > > > To:
> > > > Cc:
> > > > Bcc:
> > > >
> > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > Subject:
> > > >
> > > > Attach a file
> > > >
> > > > Send  Save Draft  Discard      Check spelling
> > > >
> > > > Atishay Kumar
> > > > <at...@gmail.com> to Tomcat, me
> > > >          More options    6:47am (6 hours ago)
> > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff <ew...@gmail.com>
> > > > wrote:
> > > > > I have gone over some of the tomcat docs and googled errors but
> > > > > there is SO much information covering JNDI, connection pooling, and
> > > > > Datasources.  Can someone review the info below and consult or point
> > > > > me in the right direction?  Although I feel I'm missing something
> > > > > obvious, I can't find out what's wrong with my set-up.
> > > > >
> > > > > thx
> > > > > Eric
> > > > >
> > > > > System:
> > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > Server 9.4 on Windows Server
> > > > >
> > > > > -I am able to connect to my db via typical JDBC
> > > > > DriverManager.getConnection().  This leads me to believe that my
> > > > > informix jdbc driver is in the correct place...
> > > > > CATALINA_HOME/common/lib -I have a Context set up in my server.xml
> > > > > per examples in a text tutorial I'm referencing
> > > > >
> > > > > Below listed...
> > > > > -errors
> > > > > -web.xml
> > > > > -server.xml <Context> (minus connection actual values) -.java
> > > > >
> > > > > exception/errors:
> > > > > -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > create JDBC driver of class '' for connect URL 'null' SQL state:
> > > > > null Error code: 0
> > > > >
> > > > > -stack trace reveals this, but I can't see why since I have the
> > > > > driver in the correct directory...
> > > > > java.sql.SQLException: No suitable driver at
> > > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > ur
> > > > > ce.java:773)
> > > > >
> > > > > web.xml:
> > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > <!DOCTYPE web-app
> > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > <web-app>
> > > > >         <servlet>
> > > > >                 <servlet-name>Test Connection Pooling</servlet-name>
> > > > >                 <servlet-class>TestConnectionPooling</servlet-class>
> > > > >         </servlet>
> > > > >
> > > > >         <servlet-mapping>
> > > > >                 <servlet-name>Test Connection Pooling</servlet-name>
> > > > >                 <url-pattern>/testConnectionPooling</url-pattern>
> > > > >         </servlet-mapping>
> > > > >
> > > > >         <resource-ref>
> > > > >           <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > >           <res-auth>Container</res-auth>
> > > > >         </resource-ref>
> > > > > </web-app>
> > > > >
> > > > > server.xml <Context>:
> > > > >   <Context path="/testConnectionPooling"
> > > > > docBase="testConnectionPooling" debug="0" reloadable="true">
> > > >
> > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > type="javax.sql.DataSource"/> is missing
> > > >
> > > > >     <ResourceParams name="jdbc/test_connect">
> > > > >       <parameter>
> > > > >         <name>username</name>
> > > > >         <value>informix</value>
> > > > >       </parameter>
> > > > >       <parameter>
> > > > >         <name>password</name>
> > > > >         <value>informix</value>
> > > > >       </parameter>
> > > > >       <parameter>
> > > > >         <name>driverClassName</name>
> > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > >       </parameter>
> > > > >       <parameter>
> > > > >         <name>url</name>
> > > > >
> > > > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > /value
> > > > >
> > > > >       </parameter>
> > > > >     </ResourceParams>
> > > > >   </Context>
> > > > >
> > > > > .java:
> > > > > import java.io.*;
> > > > > import java.sql.*;
> > > > > // -Must import javax.naming use JNDI which is required to implement
> > > data
> > > > > //   resource references and hence connection pooling.
> > > > > import javax.naming.*;
> > > > > import javax.sql.*;
> > > > > import javax.servlet.*;
> > > > > import javax.servlet.http.*;
> > > > > import java.util.*;
> > > > >
> > > > > public class TestConnectionPooling extends HttpServlet {
> > > > >         private DataSource dataSource;
> > > > >
> > > > >         public void init(ServletConfig config) throws ServletException {
> > > > >                 try {
> > > > >                         Context init = new InitialContext();
> > > > >                         // don't know what the 'java:comp/env' refers to
> > > > >                         Context ctx = (Context)
> > > > init.lookup("java:comp/env");
> > > > >                         // I know "jdbc/conversion must match the
> > > > > web.xml res-ref-name of the web.xml but don't know what the path
> > > > > really
> > > > refers to
> > > > >                         dataSource = (DataSource)
> > > > ctx.lookup("jdbc/test_connect");
> > > > >                 } catch (NamingException ex) {
> > > > >                         throw new ServletException("Cannot retrieve
> > > > > java:comp/env/jdbc/test_connect",ex);
> > > > >                 }
> > > > >         }
> > > > >
> > > > >         public void doGet(HttpServletRequest request,
> > > > > HttpServletResponse
> > > > response)
> > > > >         throws ServletException, IOException {
> > > > >                 response.setContentType("text/html");
> > > > >                 PrintWriter out = response.getWriter();
> > > > >                 Connection connection = null;
> > > > >                 out.println ("<HTML><HEAD><TITLE>Test Connection
> > > > > Pooling</TITLE></HEAD><BODY>");
> > > > >                 out.println("<H1>Customer Name Query</H1>");
> > > > >
> > > > >                 try {
> > > > >                         synchronized(dataSource) {
> > > > >                             connection = dataSource.getConnection();
> > > > >                         }
> > > > >                         out.println("<br>");
> > > > >                         out.println("<strong>Loaded informix driver
> > > > > successfully via server.xml.</strong>" +
> > > > >                                                 "Now attempting db
> > > > connection.");
> > > > >                         out.println("<br>");
> > > > >                         PreparedStatement pstmt =
> > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > >                         ResultSet results = pstmt.executeQuery();
> > > > >                         if (!results.next()) {
> > > > >                                 throw new SQLException("No data
> > > > > returned
> > > > for some reason");
> > > > >                         }
> > > > >                         out.println("<br>");
> > > > >                         while(results.next()) {
> > > > >                                 out.println("<tr><td>" +
> > > > results.getString("blah") + "</td></tr>");
> > > > >                         }
> > > > >         } catch (Exception ex) {
> > > > >                         out.println("<br>");
> > > > >                         out.println("Exception: " + ex);
> > > > >                         if(ex instanceof SQLException) {
> > > > >                                 SQLException sqlex = (SQLException) ex;
> > > > >                                 out.println("<br>");
> > > > >                                 out.println("SQL state:
> > > > "+sqlex.getSQLState()+"<BR>");
> > > > >                                 out.println("<br>");
> > > > >                                 out.println("Error code:
> > > > "+sqlex.getErrorCode()+"<BR>");
> > > > >                                 out.println("<br><br>");
> > > > >                                 sqlex.printStackTrace(out);
> > > > >                                 out.println("<br><br>");
> > > > >                         }
> > > > >         }
> > > > >         finally {
> > > > >             try { connection.close(); } catch (Exception ex) {}
> > > > >         }
> > > > >                 out.println ("</BODY></HTML>");
> > > > >
> > > > >
> > > > >     }
> > > > > }
> > > >
> > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > <ph...@shareowner.com>
> > > > wrote:
> > > > > Detail, detail, detail.
> > > > >
> > > > > 1. your context.xml
> > > > > 2. your web.xml
> > > > > 3. how do you obtain connection from pool, java code pls. 4. can you
> > > > > connect using pool 5. commons-pool version
> > > > >
> > > > > Etc. etc.
> > > > >
> > > > > You need to provide details otherwise we can't help.
> > > > >
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > Sent: October 6, 2004 5:09 PM
> > > > > To: tomcat-user@jakarta.apache.org
> > > > > Subject: connection pooling
> > > > >
> > > > > Hi all, I have gone over some of the tomcat docs and googled errors
> > > > > but there is SO much information covering JNDI and Datasources...
> > > > > and I'm hoping I don't have to be a JNDI/Datasource and XML guru
> > > > > just to set up db connections via connection pool.
> > > > >
> > > > > My situation is this...
> > > > >
> > > > > System:
> > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > Server 9.4 on Windows Server
> > > > >
> > > > > -I am able to connect to my db via typical JDBC
> > > > > DriverManager.getConnection(). -This leads me to believe that my
> > > > > jdbc driver is in the correct place ...CATALINA
> > > > >
> > > > > --------------------------------------------------------------------
> > > > > -
> > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > >
> > > > !DSPAM:4165a84c9322136420805!
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > >
> > >
> > > !DSPAM:4165bb7715701366110907!
> > >
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> 
> 
> --
> 
> 
> :)
> Atishay Kumar
> Btech, SEM VII
> DA-IICT
> Gandhinagar - 382009
> India
> ph: +91 9825383948
> /****************************************************************************
>  * Learn the rules as you would need them to break them properly *
>  ****************************************************************************/
>

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


Re: connection pooling

Posted by Eric Wulff <ew...@gmail.com>.
Well, my informix driver does support connection pooling as-is so I do
not need to use a Jakarta Commons DBCP wrapper in order to take
advantage of database connection pooling.  Thx for clarifying and for
sharing your ResourceParams.  I need to study this issue some more in
general since I only have a surface understanding of what connection
pooling really is and what it's advantages are.  For now, my app is
successfully utilizing connection pooling, as far as I can tell.  My
problem, which initiated this thread, has been solved by putting a
myapp.xml with the necessary context in my
$CATALINA_HOME/conf/Catalina/localhost/ directory.

thx
Eric


On Tue, 9 Nov 2004 00:40:23 -0000, Steve Kirk
<to...@web-startup.co.uk> wrote:
> 
> Worth clarifyig what we are meaning by "DBCP".  The DBCP I was referring to
> was the specific implementation of connection pooling that is part of
> Jakarta Commons:
> http://jakarta.apache.org/commons/dbcp/
> 
> There are other pooling implementations which are alternatives to Commons
> DBCP.
> 
> Some DB drivers included pooling support as-is.  Others do not.  For those
> that do not, you need to implement pooling by building code around the
> standard driver.  You used to have to do this yourself, but now there is
> DBCP to take care of this for you.  DBCP is a "wrapper" used around a
> non-pooling DB driver.
> 
> So, hence my question, are you intending to use DBCP, or does your Informix
> driver include pooling?
> 
> From the JNDI/JDBC guides it appears that you have the choice of using DBCP
> or not (although there is one aspect of the docs that seem slightly unclear
> on that, which I am going start another thread to clear up).  The configs
> are similar.  Personally I have only got the DBCP approach to work, hence my
> suggestion of using that, for which you need to include the factory
> parameter.  What this does is basically tells TC to call DBCP rather than
> your database driver when making a connection - DBCP then calls your DB
> driver if and when it needs to.
> 
> I think I'm right in saying that if you don't explcitly use DBCP, and your
> DB driver does not support pooling, you will end up with non-pooled
> connections.  The webapp will still work but you will not have the
> advantages of pooling.
> 
> In case it helps, here are my ResourceParams.  Note that I have both
> "factory" and "driverClassName":
> 
>         <ResourceParams name="jdbc/myDb">
>                 <parameter>
>                         <name>factory</name>
> 
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>                 </parameter>
>                 <parameter>
>                         <name>driverClassName</name>
>                         <value>com.mysql.jdbc.Driver</value>
>                 </parameter>
>                 <parameter>
>                         <name>username</name>
>                         <value>me</value>
>                 </parameter>
>                 <parameter>
>                         <name>password</name>
>                         <value>secret</value>
>                 </parameter>
>                 <parameter>
>                          <name>url</name>
>                          <value>jdbc:mysql://localhost:3306/myDb</value>
>                 </parameter>
>         </ResourceParams>
> 
> 
> 
> 
> > -----Original Message-----
> > From: Eric Wulff [mailto:ewulff@gmail.com]
> > Sent: Friday 05 November 2004 18:34
> > To: Steve Kirk
> > Cc: Tomcat Users List
> > Subject: Re: connection pooling
> >
> >
> > Steve, I am trying to use DBCP(hence the subject of the thread) and I
> > believe I have a driver that supports it.  Especially considering that
> > the connection works when I wrap my data resource in a DefaultContext
> > tag inside a stand alone Engine tag(server.xml), instead of inside a
> > Context tag(how all instructions I've followed so far suggest).
> >
> > This means my driver support DBCP, correct?
> >
> > The only source code I imagine would help is the code I use to gain
> > connection...
> >
> > Context initialContext = new InitialContext();
> > Context context = (Context) initialContext.lookup("java:comp/env");
> > DataSource dataSource = (DataSource) context.lookup("jdbc/wms");
> > connection = dataSource.getConnection();
> >
> > I have seen no mention of this factory class parameter you speak of.
> > I'm using TC 5.0.28.  I'll try it.
> >
> > thx much for your help
> > Eric
> >
> >
> > On Fri, 5 Nov 2004 13:30:35 -0000, Steve Kirk
> > <to...@web-startup.co.uk> wrote:
> > > Eric - you are correct,  you do not need both
> > <resource-ref> and <Resource>
> > > (although I've found that having both does not cause a problem).
> > >
> > > Back to your problem.
> > >
> > > The error message indicates that TC cannot find the Resource.
> > >
> > > I'm not sure if you are trying to use DBCP or not (in other
> > words, does the
> > > informix driver support pooling on its own, or do you in
> > fact need DBCP or
> > > some other implementation wrapped around it)?  You have
> > > <res-type>javax.sql.DataSource</res-type> but do not list
> > the factory class
> > > under your Resource, e.g. :
> > > <parameter>
> > >         <name>factory</name>
> > >
> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> > > </parameter>
> > >
> > > I have not seen any Java source code on this thread, maybe
> > you posted it
> > > before I started reading it.
> > >
> > > Thinking slightly laterally I'll pass on something I
> > learned from Yoav
> > > recently on this list.... you don't need to use
> > container-managed resources
> > > to do connection pooling.  In other words you don't need to
> > set any Resource
> > > or Context to get it to work.
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > Sent: Friday 05 November 2004 05:57
> > > > To: Tomcat Users List; Atishay Kumar
> > > > Subject: Re: connection pooling
> > > >
> > > >
> > > > Thx for your input but, as mentioned in my previous message, I've
> > > > tried this and it does not work.  Also, considering my web.xml I
> > > > shouldn't need this, correct?  I have a <resource-ref> in
> > my web.xml.
> > > >
> > > > Eric
> > > >
> > > >
> > > > On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar
> > > > <at...@gmail.com> wrote:
> > > > >
> > > > > Pls do the following change after <context......> and u are on!!
> > > > > cheers
> > > > >
> > > > >
> > > > > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff
> > > > <ew...@gmail.com> wrote:
> > > > > > Hi all, I'm returning to a problem I couldn't solve the
> > > > first time,
> > > > > > about two months ago, and still can't seem to figure out.
> > > >  I can't get
> > > > > > a db connection using connection pools.  I get the
> > > > exception listed
> > > > > > below, same as so many have previously, but nothing I've
> > > > found seems
> > > > > > to works.  Below are my specs.  Anyone with concrete
> > > > advise/direction
> > > > > > on how to get
> > > > > > this working?
> > > > > >
> > > > > > Also, I noticed in many solutions the suggestion was made
> > > > to edit the
> > > > > > myapp.xml file located at
> > CATALINA_HOME/conf/Catalina/localhost/.
> > > > > > However, there is no myapp.xml in that directory on my
> > > > server. Just 2
> > > > > > .xml's related to other applications and a manager.xml
> > > > which I'm not
> > > > > > sure what it's related to.
> > > > > >
> > > > > > OS: FC2
> > > > > > Tomcat 5.0.28
> > > > > >
> > > > > > exception: org.apache.commons.dbcp.SWLNestedException:
> > > > Cannot create
> > > > > > JDBC driver class '' for connect URL 'null'
> > > > > >
> > > > > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> > > > > >         <resource-ref>
> > > > > >                 <res-ref-name>jdbc/wms</res-ref-name>
> > > > > >                 <res-type>javax.sql.DataSource</res-type>
> > > > > >                 <res-auth>Container</res-auth>
> > > > > >         </resource-ref>
> > > > > >
> > > > > > server xml(tried this with and without a Resource name)...
> > > > > > <Context path="/wms" docBase="wms" debug="0"
> > reloadable="true">
> > > > >
> > > > > <Resource name="jdbc/wms" auth="Container"
> > > > type="javax.sql.DataSource"/>
> > > > >
> > > > >
> > > > >
> > > > > >     <ResourceParams name="jdbc/wms">
> > > > > >       <parameter>
> > > > > >         <name>username</name>
> > > > > >         <value>whatever</value>
> > > > > >       </parameter>
> > > > > >       <parameter>
> > > > > >         <name>password</name>
> > > > > >         <value>whatever</value>
> > > > > >       </parameter>
> > > > > >       <parameter>
> > > > > >         <name>driverClassName</name>
> > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > >       </parameter>
> > > > > >           <parameter>
> > > > > >                 <name>url</name>
> > > > > >
> > > > <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORM
> > > > IXSERVER=serverName</value>
> > > > > >         </parameter>
> > > > > >     </ResourceParams>
> > > > > >   </Context>
> > > > > >
> > > > > > I have the following jars in my
> > > > <CATALINA_HONE>/common/lib and I also
> > > > > > tried putting the db driver and commons-collections,
> > > > dbcp, and pool in
> > > > > > my WEB-INF/lib with no success.  They are all mode 644.
> > > > > >
> > > > > > ant.jar
> > > > > > ant-launcher.jar
> > > > > > commons-collections-3.1.jar
> > > > > > commons-dbcp-1.2.1.jar
> > > > > > commons-el.jar
> > > > > > commons-pool-1.2.jar
> > > > > > ifxjdbc.jar (the necessary informix driver)
> > > > > > jar.txt
> > > > > > jasper-compiler.jar
> > > > > > jasper-runtime.jar
> > > > > > jsp-api.jar
> > > > > > mysql-connector-java-3.0.15-ga-bin.jar
> > > > > > naming-common.jar
> > > > > > naming-factory.jar
> > > > > > naming-java.jar
> > > > > > naming-resources.jar
> > > > > > servlet-api.jar
> > > > > >
> > > > > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > > > > > <at...@gmail.com> wrote:
> > > > > > > hi,
> > > > > > >  i am not sure but you may try downloading latest
> > jar files for
> > > > > > > following froom tomcat site and try them out. copy the
> > > > old jar files
> > > > > > > somewhere else and try using the latest jar files.
> > > > > > > 1) Commons Collections
> > > > > > > 2)Commons DBCP
> > > > > > > 3)Commons Pool
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff
> > > > <ew...@gmail.com> wrote:
> > > > > > > > Except that the driver works for connecting if I'm
> > > > not utilizing a
> > > > > > > > connection pool, i.e., I am able to connect to the db
> > > > and manipulate
> > > > > > > > data via DriverManager.getConnection(url, db, pwd).
> > > > > > > >
> > > > > > > > The driver is located in CATALINA_HOME/commons/lib
> > > > > > > >
> > > > > > > > Eric
> > > > > > > >
> > > > > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > > > > > <ph...@shareowner.com> wrote:
> > > > > > > > > No, you don't need that many params. I think your
> > > > problem might be the
> > > > > > > >
> > > > > > > >
> > > > > > > > > driver. Where did you drop off your informix jdbc jar?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > Sent: October 7, 2004 5:56 PM
> > > > > > > > > To: Tomcat Users List
> > > > > > > > > Subject: Re: connection pooling
> > > > > > > > >
> > > > > > > > > Yes, I have added <Resource name=... >.  Now
> > > > different errors are reported
> > > > > > > > > via stack trace as I posted in response to
> > > > Atishay's suggestion that I add
> > > > > > > > > this.  I'll try adding your suggestions and see
> > > > what happens.  Also, you
> > > > > > > > > suggest adding many parameters.  Are they necessary
> > > > for simply making a
> > > > > > > > > connection?  If so, the tutorial I'm following,
> > > > 'Tomcat Kick Start' left all
> > > > > > > > > your suggestions out.
> > > > > > > > > Including the <Resource> tag, but that seems
> > > > critical for connection.
> > > > > > > > >
> > > > > > > > > Eric
> > > > > > > > >
> > > > > > > > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin
> > > > <ph...@shareowner.com>
> > > > > > > > > wrote:
> > > > > > > > > > 1. web.xml: OK
> > > > > > > > > >
> > > > > > > > > > 2. context.xml on <context> of server.xml:
> > > > > > > > > >
> > > > > > > > > >         <Resource name="jdbc/test_connect"
> > > > auth="Container"
> > > > > > > > > > type="javax.sql.DataSource"/> <= have you added this?
> > > > > > > > > >         <ResourceParams name="jdbc/test_connect">
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>driverClassName</name>
> > > > > > > > > >                 <value>your.jdbc.driver</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>url</name>
> > > > > > > > > >                 <value>your.jdbc.url</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>username</name>
> > > > > > > > > >                 <value>youruser</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>password</name>
> > > > > > > > > >                 <value>yourpass</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>maxActive</name>
> > > > > > > > > >                 <value>20</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>maxIdle</name>
> > > > > > > > > >                 <value>10</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>minIdle</name>
> > > > > > > > > >                 <value>10</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>maxWait</name>
> > > > > > > > > >                 <value>15000</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>removeAbandoned</name>
> > > > > > > > > >                 <value>true</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>validationQuery</name>
> > > > > > > > > >                 <value>your_query</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>testOnBorrow</name>
> > > > > > > > > >                 <value>true</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>testOnReturn</name>
> > > > > > > > > >                 <value>true</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >
> > <name>minEvictableIdleTimeMillis</name>
> > > > > > > > > >                 <value>-1</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <!-- sleeps 5 minutes -->
> > > > > > > > > >         <parameter>
> > > > > > > > > >
> > <name>timeBetweenEvictionRunsMillis</name>
> > > > > > > > > >                 <value>300000</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>numTestsPerEvictionRun</name>
> > > > > > > > > >                 <value>1</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >         <parameter>
> > > > > > > > > >                 <name>testWhileIdle</name>
> > > > > > > > > >                 <value>true</value>
> > > > > > > > > >         </parameter>
> > > > > > > > > >
> > > > > > > > > >         </ResourceParams>
> > > > > > > > > >
> > > > > > > > > > 3. code
> > > > > > > > > >
> > > > > > > > > >                 Context initContext = new
> > > > InitialContext();
> > > > > > > > > >                 Context jdbcContext = (Context)
> > > > > > > > > > initContext.lookup("java:comp/env");
> > > > > > > > > >                 DataSource dataSource = (DataSource)
> > > > > > > > > > jdbcContext.lookup("jdbc/test_connect");
> > > > > > > > > >                 ...
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > > Sent: October 7, 2004 4:34 PM
> > > > > > > > > > To: Tomcat Users List
> > > > > > > > > > Subject: Re: connection pooling
> > > > > > > > > >
> > > > > > > > > > Hi Phillip,
> > > > > > > > > >
> > > > > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > > > > > > > Detail, detail, detail.
> > > > > > > > > > >
> > > > > > > > > > > 1. your context.xml
> > > > > > > > > > > 2. your web.xml
> > > > > > > > > > > 3. how do you obtain connection from pool, java
> > > > code pls. 4. can you
> > > > > > > > > > > connect using pool 5. commons-pool version
> > > > > > > > > > >
> > > > > > > > > > > Etc. etc.
> > > > > > > > > > >
> > > > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > > >
> > > > > > > > > > This was all included in my original post.  Ok,
> > > > actually my 2nd post
> > > > > > > > > > because I accidentally hit send prior to
> > > > completing my post via the
> > > > > > > > > > scroll pad on my laptop.  Still, thx for checking
> > > > on this and the info
> > > > > > > > > > you looking for is copied again here...
> > > > > > > > > >
> > > > > > > > > > System:
> > > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > > an Informix Dynamic
> > > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > > >
> > > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > > DriverManager.getConnection().  This leads me to
> > > > believe that my
> > > > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > > > CATALINA_HOME/common/lib -I have a Context set up
> > > > in my server.xml per
> > > > > > > > > > examples in a text tutorial I'm referencing
> > > > > > > > > >
> > > > > > > > > > Below listed...
> > > > > > > > > > -errors
> > > > > > > > > > -web.xml
> > > > > > > > > > -server.xml <Context> (minus connection actual values)
> > > > > > > > > > -.java
> > > > > > > > > >
> > > > > > > > > > exception/errors:
> > > > > > > > > > -Exception:
> > > > org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > > > > > > > JDBC driver of class '' for connect URL 'null'
> > > > SQL state: null Error
> > > > > > > > > > code: 0
> > > > > > > > > >
> > > > > > > > > > -stack trace reveals this, but I can't see why
> > > > since I have the driver
> > > > > > > > > > in the correct directory...
> > > > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > > > >
> > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > > > >
> > > >
> > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > > > > > > > ce.jav
> > > > > > > > > > a:773)
> > > > > > > > > >
> > > > > > > > > > web.xml:
> > > > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > > > <!DOCTYPE web-app
> > > > > > > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> > > > Application 2.3//EN"
> > > > > > > > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > > > <web-app>
> > > > > > > > > >        <servlet>
> > > > > > > > > >                <servlet-name>Test Connection
> > > > Pooling</servlet-name>
> > > > > > > > > >
> > > > <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > > > >        </servlet>
> > > > > > > > > >
> > > > > > > > > >        <servlet-mapping>
> > > > > > > > > >                <servlet-name>Test Connection
> > > > Pooling</servlet-name>
> > > > > > > > > >
> > > > <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > > > >        </servlet-mapping>
> > > > > > > > > >
> > > > > > > > > >        <resource-ref>
> > > > > > > > > >
> > <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > > > >          <res-type>javax.sql.DataSource</res-type>
> > > > > > > > > >          <res-auth>Container</res-auth>
> > > > > > > > > >        </resource-ref>
> > > > > > > > > > </web-app>
> > > > > > > > > >
> > > > > > > > > > server.xml <Context>:
> > > > > > > > > >  <Context path="/testConnectionPooling"
> > > > > > > > > > docBase="testConnectionPooling" debug="0"
> > > > reloadable="true">
> > > > > > > > > >    <ResourceParams name="jdbc/test_connect">
> > > > > > > > > >      <parameter>
> > > > > > > > > >        <name>username</name>
> > > > > > > > > >        <value>informix</value>
> > > > > > > > > >      </parameter>
> > > > > > > > > >      <parameter>
> > > > > > > > > >        <name>password</name>
> > > > > > > > > >        <value>informix</value>
> > > > > > > > > >      </parameter>
> > > > > > > > > >      <parameter>
> > > > > > > > > >        <name>driverClassName</name>
> > > > > > > > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > > > >      </parameter>
> > > > > > > > > >      <parameter>
> > > > > > > > > >        <name>url</name>
> > > > > > > > > >
> > > >
> > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > > > > /value
> > > > > > > > > > >
> > > > > > > > > >      </parameter>
> > > > > > > > > >    </ResourceParams>
> > > > > > > > > >  </Context>
> > > > > > > > > >
> > > > > > > > > > .java:
> > > > > > > > > > import java.io.*;
> > > > > > > > > > import java.sql.*;
> > > > > > > > > > // -Must import javax.naming use JNDI which is
> > > > required to implement data
> > > > > > > > > > //   resource references and hence connection pooling.
> > > > > > > > > > import javax.naming.*;
> > > > > > > > > > import javax.sql.*;
> > > > > > > > > > import javax.servlet.*;
> > > > > > > > > > import javax.servlet.http.*;
> > > > > > > > > > import java.util.*;
> > > > > > > > > >
> > > > > > > > > > public class TestConnectionPooling extends
> > HttpServlet {
> > > > > > > > > >        private DataSource dataSource;
> > > > > > > > > >
> > > > > > > > > >        public void init(ServletConfig config)
> > > > throws ServletException {
> > > > > > > > > >                try {
> > > > > > > > > >                        Context init = new
> > > > InitialContext();
> > > > > > > > > >                        // don't know what the
> > > > 'java:comp/env' refers to
> > > > > > > > > >                        Context ctx = (Context)
> > > > > > > > > init.lookup("java:comp/env");
> > > > > > > > > >                        // I know "jdbc/conversion
> > > > must match the
> > > > > > > > > > web.xml res-ref-name of the web.xml but don't
> > > > know what the path really
> > > > > > > > > refers to
> > > > > > > > > >                        dataSource = (DataSource)
> > > > > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > > > >                } catch (NamingException ex) {
> > > > > > > > > >                        throw new
> > > > ServletException("Cannot retrieve
> > > > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > > > >                }
> > > > > > > > > >        }
> > > > > > > > > >
> > > > > > > > > >        public void doGet(HttpServletRequest request,
> > > > > > > > > > HttpServletResponse
> > > > > > > > > > response)
> > > > > > > > > >        throws ServletException, IOException {
> > > > > > > > > >                response.setContentType("text/html");
> > > > > > > > > >                PrintWriter out = response.getWriter();
> > > > > > > > > >                Connection connection = null;
> > > > > > > > > >                out.println
> > > > ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > > > >                out.println("<H1>Customer Name
> > > > Query</H1>");
> > > > > > > > > >
> > > > > > > > > >                try {
> > > > > > > > > >                        synchronized(dataSource) {
> > > > > > > > > >                            connection =
> > > > dataSource.getConnection();
> > > > > > > > > >                        }
> > > > > > > > > >                        out.println("<br>");
> > > > > > > > > >
> > > > out.println("<strong>Loaded informix driver
> > > > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > > > >
> > > > "Now attempting db
> > > > > > > > > > connection.");
> > > > > > > > > >                        out.println("<br>");
> > > > > > > > > >                        PreparedStatement pstmt =
> > > > > > > > > > connection.prepareStatement("SELECT blah FROM
> > blah blah");
> > > > > > > > > >                        ResultSet results =
> > > > pstmt.executeQuery();
> > > > > > > > > >                        if (!results.next()) {
> > > > > > > > > >                                throw new
> > > > SQLException("No data
> > > > > > > > > > returned for some reason");
> > > > > > > > > >                        }
> > > > > > > > > >                        out.println("<br>");
> > > > > > > > > >                        while(results.next()) {
> > > > > > > > > >
> > out.println("<tr><td>" +
> > > > > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > > > >                        }
> > > > > > > > > >        } catch (Exception ex) {
> > > > > > > > > >                        out.println("<br>");
> > > > > > > > > >
> > out.println("Exception: " + ex);
> > > > > > > > > >                        if(ex instanceof
> > SQLException) {
> > > > > > > > > >                                SQLException sqlex
> > > > = (SQLException) ex;
> > > > > > > > > >                                out.println("<br>");
> > > > > > > > > >                                out.println("SQL state:
> > > > > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > > > >                                out.println("<br>");
> > > > > > > > > >
> > out.println("Error code:
> > > > > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > > > >
> > out.println("<br><br>");
> > > > > > > > > >
> > sqlex.printStackTrace(out);
> > > > > > > > > >
> > out.println("<br><br>");
> > > > > > > > > >                        }
> > > > > > > > > >        }
> > > > > > > > > >        finally {
> > > > > > > > > >            try { connection.close(); } catch
> > > > (Exception ex) {}
> > > > > > > > > >        }
> > > > > > > > > >                out.println ("</BODY></HTML>");
> > > > > > > > > >    }
> > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > >   ReplyForward
> > > > > > > > > >
> > > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > > java code: Context ctx = (Context)
> > > > init.lookup("xxxxxx"); server.xml:
> > > > > > > > > > <Resour...
> > > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > > >
> > > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > > Please ignore my last post - it's wrong.
> > > > (Answered before verifying).
> > > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > > >
> > > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > > Is that litterally what you have in your server.xml?
> > > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > > >
> > > > > > > > > > Eric Wulff
> > > > > > > > > > No, literally I have the actual values. The same
> > > > connection string I
> > > > > > > > > > use to s...
> > > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > > >
> > > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > > Is there a xxxxx.xml file in
> > > > (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > > > > > > > where xxx...
> > > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > > >
> > > > > > > > > > Eric Wulff
> > > > > > > > > > Context name? I assume your referring to the
> > > > ResourceParams name
> > > > > > > > > > attribute, j...
> > > > > > > > > >                  Oct 6 (19 hours ago)
> > > > > > > > > >
> > > > > > > > > > Phillip Qin
> > > > > > > > > > <ph...@shareowner.com> to Tomcat
> > > > > > > > > >          More options    6:29am (7 hours ago)
> > > > > > > > > > Detail, detail, detail.
> > > > > > > > > >
> > > > > > > > > > 1. your context.xml
> > > > > > > > > > 2. your web.xml
> > > > > > > > > > 3. how do you obtain connection from pool,
> > java code pls.
> > > > > > > > > > 4. can you connect using pool
> > > > > > > > > > 5. commons-pool version
> > > > > > > > > >
> > > > > > > > > > Etc. etc.
> > > > > > > > > >
> > > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > > > - Show quoted text -
> > > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > > > Subject: connection pooling
> > > > > > > > > >
> > > > > > > > > > Hi all, I have gone over some of the tomcat docs
> > > > and googled errors
> > > > > > > > > > but there is SO much information covering JNDI
> > > > and Datasources... and
> > > > > > > > > > I'm hoping I don't have to be a JNDI/Datasource
> > > > and XML guru just to
> > > > > > > > > > set up db connections via connection pool.
> > > > > > > > > >
> > > > > > > > > > My situation is this...
> > > > > > > > > >
> > > > > > > > > > System:
> > > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > > an Informix Dynamic
> > > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > > >
> > > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > > DriverManager.getConnection(). -This leads me to
> > > > believe that my jdbc
> > > > > > > > > > driver is in the correct place ...CATALINA
> > > > > > > > > >
> > > > > > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > > > tomcat-user-help@jakarta.apache.org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >   ReplyForwardInvite Phillip to Gmail
> > > > > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > > > > To:
> > > > > > > > > > Cc:
> > > > > > > > > > Bcc:
> > > > > > > > > >
> > > > > > > > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > > > > > > > Subject:
> > > > > > > > > >
> > > > > > > > > > Attach a file
> > > > > > > > > >
> > > > > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > > > >
> > > > > > > > > > Atishay Kumar
> > > > > > > > > > <at...@gmail.com> to Tomcat, me
> > > > > > > > > >          More options    6:47am (6 hours ago)
> > > > > > > > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff
> > > > <ew...@gmail.com>
> > > > > > > > > > wrote:
> > > > > > > > > > > I have gone over some of the tomcat docs and
> > > > googled errors but
> > > > > > > > > > > there is SO much information covering JNDI,
> > > > connection pooling, and
> > > > > > > > > > > Datasources.  Can someone review the info below
> > > > and consult or point
> > > > > > > > > > > me in the right direction?  Although I feel I'm
> > > > missing something
> > > > > > > > > > > obvious, I can't find out what's wrong with
> > my set-up.
> > > > > > > > > > >
> > > > > > > > > > > thx
> > > > > > > > > > > Eric
> > > > > > > > > > >
> > > > > > > > > > > System:
> > > > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > > an Informix Dynamic
> > > > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > > > >
> > > > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > > > DriverManager.getConnection().  This leads me
> > > > to believe that my
> > > > > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > > > > CATALINA_HOME/common/lib -I have a Context set
> > > > up in my server.xml
> > > > > > > > > > > per examples in a text tutorial I'm referencing
> > > > > > > > > > >
> > > > > > > > > > > Below listed...
> > > > > > > > > > > -errors
> > > > > > > > > > > -web.xml
> > > > > > > > > > > -server.xml <Context> (minus connection actual
> > > > values) -.java
> > > > > > > > > > >
> > > > > > > > > > > exception/errors:
> > > > > > > > > > > -Exception:
> > > > org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > > > > > > > create JDBC driver of class '' for connect URL
> > > > 'null' SQL state:
> > > > > > > > > > > null Error code: 0
> > > > > > > > > > >
> > > > > > > > > > > -stack trace reveals this, but I can't see why
> > > > since I have the
> > > > > > > > > > > driver in the correct directory...
> > > > > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > > > > >
> > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > > > > >
> > > >
> > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > > > > > > > ur
> > > > > > > > > > > ce.java:773)
> > > > > > > > > > >
> > > > > > > > > > > web.xml:
> > > > > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > > > > <!DOCTYPE web-app
> > > > > > > > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> > > > Application 2.3//EN"
> > > > > > > > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > > > > <web-app>
> > > > > > > > > > >         <servlet>
> > > > > > > > > > >                 <servlet-name>Test Connection
> > > > Pooling</servlet-name>
> > > > > > > > > > >
> > > > <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > > > > >         </servlet>
> > > > > > > > > > >
> > > > > > > > > > >         <servlet-mapping>
> > > > > > > > > > >                 <servlet-name>Test Connection
> > > > Pooling</servlet-name>
> > > > > > > > > > >
> > > > <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > > > > >         </servlet-mapping>
> > > > > > > > > > >
> > > > > > > > > > >         <resource-ref>
> > > > > > > > > > >
> > <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > > > > > > > >           <res-auth>Container</res-auth>
> > > > > > > > > > >         </resource-ref>
> > > > > > > > > > > </web-app>
> > > > > > > > > > >
> > > > > > > > > > > server.xml <Context>:
> > > > > > > > > > >   <Context path="/testConnectionPooling"
> > > > > > > > > > > docBase="testConnectionPooling" debug="0"
> > > > reloadable="true">
> > > > > > > > > >
> > > > > > > > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > > > > > > > type="javax.sql.DataSource"/> is missing
> > > > > > > > > >
> > > > > > > > > > >     <ResourceParams name="jdbc/test_connect">
> > > > > > > > > > >       <parameter>
> > > > > > > > > > >         <name>username</name>
> > > > > > > > > > >         <value>informix</value>
> > > > > > > > > > >       </parameter>
> > > > > > > > > > >       <parameter>
> > > > > > > > > > >         <name>password</name>
> > > > > > > > > > >         <value>informix</value>
> > > > > > > > > > >       </parameter>
> > > > > > > > > > >       <parameter>
> > > > > > > > > > >         <name>driverClassName</name>
> > > > > > > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > > > > >       </parameter>
> > > > > > > > > > >       <parameter>
> > > > > > > > > > >         <name>url</name>
> > > > > > > > > > >
> > > > > > > > > >
> > > >
> > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > > > > /value
> > > > > > > > > > >
> > > > > > > > > > >       </parameter>
> > > > > > > > > > >     </ResourceParams>
> > > > > > > > > > >   </Context>
> > > > > > > > > > >
> > > > > > > > > > > .java:
> > > > > > > > > > > import java.io.*;
> > > > > > > > > > > import java.sql.*;
> > > > > > > > > > > // -Must import javax.naming use JNDI which is
> > > > required to implement
> > > > > > > > > data
> > > > > > > > > > > //   resource references and hence
> > connection pooling.
> > > > > > > > > > > import javax.naming.*;
> > > > > > > > > > > import javax.sql.*;
> > > > > > > > > > > import javax.servlet.*;
> > > > > > > > > > > import javax.servlet.http.*;
> > > > > > > > > > > import java.util.*;
> > > > > > > > > > >
> > > > > > > > > > > public class TestConnectionPooling extends
> > HttpServlet {
> > > > > > > > > > >         private DataSource dataSource;
> > > > > > > > > > >
> > > > > > > > > > >         public void init(ServletConfig config)
> > > > throws ServletException {
> > > > > > > > > > >                 try {
> > > > > > > > > > >                         Context init = new
> > > > InitialContext();
> > > > > > > > > > >                         // don't know what the
> > > > 'java:comp/env' refers to
> > > > > > > > > > >                         Context ctx = (Context)
> > > > > > > > > > init.lookup("java:comp/env");
> > > > > > > > > > >                         // I know
> > > > "jdbc/conversion must match the
> > > > > > > > > > > web.xml res-ref-name of the web.xml but don't
> > > > know what the path
> > > > > > > > > > > really
> > > > > > > > > > refers to
> > > > > > > > > > >                         dataSource = (DataSource)
> > > > > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > > > > >                 } catch (NamingException ex) {
> > > > > > > > > > >                         throw new
> > > > ServletException("Cannot retrieve
> > > > > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > > > > >                 }
> > > > > > > > > > >         }
> > > > > > > > > > >
> > > > > > > > > > >         public void
> > doGet(HttpServletRequest request,
> > > > > > > > > > > HttpServletResponse
> > > > > > > > > > response)
> > > > > > > > > > >         throws ServletException, IOException {
> > > > > > > > > > >
> > response.setContentType("text/html");
> > > > > > > > > > >                 PrintWriter out =
> > response.getWriter();
> > > > > > > > > > >                 Connection connection = null;
> > > > > > > > > > >                 out.println
> > > > ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > > > > >                 out.println("<H1>Customer Name
> > > > Query</H1>");
> > > > > > > > > > >
> > > > > > > > > > >                 try {
> > > > > > > > > > >                         synchronized(dataSource) {
> > > > > > > > > > >                             connection =
> > > > dataSource.getConnection();
> > > > > > > > > > >                         }
> > > > > > > > > > >                         out.println("<br>");
> > > > > > > > > > >
> > > > out.println("<strong>Loaded informix driver
> > > > > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > > > > >
> > > > "Now attempting db
> > > > > > > > > > connection.");
> > > > > > > > > > >                         out.println("<br>");
> > > > > > > > > > >                         PreparedStatement pstmt =
> > > > > > > > > > > connection.prepareStatement("SELECT blah FROM
> > > > blah blah");
> > > > > > > > > > >                         ResultSet results =
> > > > pstmt.executeQuery();
> > > > > > > > > > >                         if (!results.next()) {
> > > > > > > > > > >                                 throw new
> > > > SQLException("No data
> > > > > > > > > > > returned
> > > > > > > > > > for some reason");
> > > > > > > > > > >                         }
> > > > > > > > > > >                         out.println("<br>");
> > > > > > > > > > >                         while(results.next()) {
> > > > > > > > > > >
> > out.println("<tr><td>" +
> > > > > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > > > > >                         }
> > > > > > > > > > >         } catch (Exception ex) {
> > > > > > > > > > >                         out.println("<br>");
> > > > > > > > > > >
> > out.println("Exception: " + ex);
> > > > > > > > > > >                         if(ex instanceof
> > SQLException) {
> > > > > > > > > > >                                 SQLException
> > > > sqlex = (SQLException) ex;
> > > > > > > > > > >                                 out.println("<br>");
> > > > > > > > > > >
> > out.println("SQL state:
> > > > > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > > > > >                                 out.println("<br>");
> > > > > > > > > > >
> > out.println("Error code:
> > > > > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > > > > >
> > out.println("<br><br>");
> > > > > > > > > > >
> > > > sqlex.printStackTrace(out);
> > > > > > > > > > >
> > out.println("<br><br>");
> > > > > > > > > > >                         }
> > > > > > > > > > >         }
> > > > > > > > > > >         finally {
> > > > > > > > > > >             try { connection.close(); } catch
> > > > (Exception ex) {}
> > > > > > > > > > >         }
> > > > > > > > > > >                 out.println ("</BODY></HTML>");
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >     }
> > > > > > > > > > > }
> > > > > > > > > >
> > > > > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > > > > > > > <ph...@shareowner.com>
> > > > > > > > > > wrote:
> > > > > > > > > > > Detail, detail, detail.
> > > > > > > > > > >
> > > > > > > > > > > 1. your context.xml
> > > > > > > > > > > 2. your web.xml
> > > > > > > > > > > 3. how do you obtain connection from pool, java
> > > > code pls. 4. can you
> > > > > > > > > > > connect using pool 5. commons-pool version
> > > > > > > > > > >
> > > > > > > > > > > Etc. etc.
> > > > > > > > > > >
> > > > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > -----Original Message-----
> > > > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > > > > Subject: connection pooling
> > > > > > > > > > >
> > > > > > > > > > > Hi all, I have gone over some of the tomcat
> > > > docs and googled errors
> > > > > > > > > > > but there is SO much information covering JNDI
> > > > and Datasources...
> > > > > > > > > > > and I'm hoping I don't have to be a
> > > > JNDI/Datasource and XML guru
> > > > > > > > > > > just to set up db connections via connection pool.
> > > > > > > > > > >
> > > > > > > > > > > My situation is this...
> > > > > > > > > > >
> > > > > > > > > > > System:
> > > > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > > an Informix Dynamic
> > > > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > > > >
> > > > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > > > DriverManager.getConnection(). -This leads me
> > > > to believe that my
> > > > > > > > > > > jdbc driver is in the correct place ...CATALINA
> > > > > > > > > > >
> > > > > > > > > > >
> > > >
> > --------------------------------------------------------------------
> > > > > > > > > > > -
> > > > > > > > > > > To unsubscribe, e-mail:
> > > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > > > For additional commands, e-mail:
> > > > tomcat-user-help@jakarta.apache.org
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > > > > > To unsubscribe, e-mail:
> > > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > > > tomcat-user-help@jakarta.apache.org
> > > > > > > > > >
> > > > > > > > > > !DSPAM:4165a84c9322136420805!
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> > > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > For additional commands, e-mail:
> > > > tomcat-user-help@jakarta.apache.org
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > !DSPAM:4165bb7715701366110907!
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > For additional commands, e-mail:
> > > > tomcat-user-help@jakarta.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > >
> > > > > > > :)
> > > > > > > Atishay Kumar
> > > > > > > Btech, SEM VII
> > > > > > > DA-IICT
> > > > > > > Gandhinagar - 382009
> > > > > > > India
> > > > > > > ph: +91 9825383948
> > > > > > >
> > > > /*************************************************************
> > > > ***************
> > > > > > >  * Learn the rules as you would need them to break them
> > > > properly *
> > > > > > >
> > > > **************************************************************
> > > > **************/
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > :)
> > > > > Atishay Kumar
> > > > > Btech, SEM VII
> > > > > DA-IICT
> > > > > Gandhinagar - 382009
> > > > > India
> > > > > ph: +91 9825383948
> > > > >
> > > > /*************************************************************
> > > > ***************
> > > > >  * Learn the rules as you would need them to break them
> > properly *
> > > > >
> > > > **************************************************************
> > > > **************/
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > >
> > > > >
> > > > > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > >
> > >
> > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> > >
> >
> 
>

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


RE: connection pooling

Posted by Steve Kirk <to...@web-startup.co.uk>.
Worth clarifyig what we are meaning by "DBCP".  The DBCP I was referring to
was the specific implementation of connection pooling that is part of
Jakarta Commons: 
http://jakarta.apache.org/commons/dbcp/ 

There are other pooling implementations which are alternatives to Commons
DBCP.

Some DB drivers included pooling support as-is.  Others do not.  For those
that do not, you need to implement pooling by building code around the
standard driver.  You used to have to do this yourself, but now there is
DBCP to take care of this for you.  DBCP is a "wrapper" used around a
non-pooling DB driver.

So, hence my question, are you intending to use DBCP, or does your Informix
driver include pooling?

>From the JNDI/JDBC guides it appears that you have the choice of using DBCP
or not (although there is one aspect of the docs that seem slightly unclear
on that, which I am going start another thread to clear up).  The configs
are similar.  Personally I have only got the DBCP approach to work, hence my
suggestion of using that, for which you need to include the factory
parameter.  What this does is basically tells TC to call DBCP rather than
your database driver when making a connection - DBCP then calls your DB
driver if and when it needs to.

I think I'm right in saying that if you don't explcitly use DBCP, and your
DB driver does not support pooling, you will end up with non-pooled
connections.  The webapp will still work but you will not have the
advantages of pooling.

In case it helps, here are my ResourceParams.  Note that I have both
"factory" and "driverClassName":

	<ResourceParams name="jdbc/myDb">
		<parameter>
			<name>factory</name>
	
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
		</parameter>
		<parameter>
			<name>driverClassName</name>
			<value>com.mysql.jdbc.Driver</value>
		</parameter>
		<parameter>
			<name>username</name>
			<value>me</value>
		</parameter>
		<parameter>
			<name>password</name>
			<value>secret</value>
		</parameter>
		<parameter>
			 <name>url</name>
			 <value>jdbc:mysql://localhost:3306/myDb</value>
		</parameter>
	</ResourceParams>


> -----Original Message-----
> From: Eric Wulff [mailto:ewulff@gmail.com] 
> Sent: Friday 05 November 2004 18:34
> To: Steve Kirk
> Cc: Tomcat Users List
> Subject: Re: connection pooling
> 
> 
> Steve, I am trying to use DBCP(hence the subject of the thread) and I
> believe I have a driver that supports it.  Especially considering that
> the connection works when I wrap my data resource in a DefaultContext
> tag inside a stand alone Engine tag(server.xml), instead of inside a
> Context tag(how all instructions I've followed so far suggest).
> 
> This means my driver support DBCP, correct?
> 
> The only source code I imagine would help is the code I use to gain
> connection...
> 
> Context initialContext = new InitialContext();
> Context context = (Context) initialContext.lookup("java:comp/env");
> DataSource dataSource = (DataSource) context.lookup("jdbc/wms");
> connection = dataSource.getConnection();
> 
> I have seen no mention of this factory class parameter you speak of. 
> I'm using TC 5.0.28.  I'll try it.
> 
> thx much for your help
> Eric
> 
> 
> On Fri, 5 Nov 2004 13:30:35 -0000, Steve Kirk
> <to...@web-startup.co.uk> wrote:
> > Eric - you are correct,  you do not need both 
> <resource-ref> and <Resource>
> > (although I've found that having both does not cause a problem).
> > 
> > Back to your problem.
> > 
> > The error message indicates that TC cannot find the Resource.
> > 
> > I'm not sure if you are trying to use DBCP or not (in other 
> words, does the
> > informix driver support pooling on its own, or do you in 
> fact need DBCP or
> > some other implementation wrapped around it)?  You have
> > <res-type>javax.sql.DataSource</res-type> but do not list 
> the factory class
> > under your Resource, e.g. :
> > <parameter>
> >         <name>factory</name>
> >         
> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> > </parameter>
> > 
> > I have not seen any Java source code on this thread, maybe 
> you posted it
> > before I started reading it.
> > 
> > Thinking slightly laterally I'll pass on something I 
> learned from Yoav
> > recently on this list.... you don't need to use 
> container-managed resources
> > to do connection pooling.  In other words you don't need to 
> set any Resource
> > or Context to get it to work.
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > Sent: Friday 05 November 2004 05:57
> > > To: Tomcat Users List; Atishay Kumar
> > > Subject: Re: connection pooling
> > >
> > >
> > > Thx for your input but, as mentioned in my previous message, I've
> > > tried this and it does not work.  Also, considering my web.xml I
> > > shouldn't need this, correct?  I have a <resource-ref> in 
> my web.xml.
> > >
> > > Eric
> > >
> > >
> > > On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar
> > > <at...@gmail.com> wrote:
> > > >
> > > > Pls do the following change after <context......> and u are on!!
> > > > cheers
> > > >
> > > >
> > > > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff
> > > <ew...@gmail.com> wrote:
> > > > > Hi all, I'm returning to a problem I couldn't solve the
> > > first time,
> > > > > about two months ago, and still can't seem to figure out.
> > >  I can't get
> > > > > a db connection using connection pools.  I get the
> > > exception listed
> > > > > below, same as so many have previously, but nothing I've
> > > found seems
> > > > > to works.  Below are my specs.  Anyone with concrete
> > > advise/direction
> > > > > on how to get
> > > > > this working?
> > > > >
> > > > > Also, I noticed in many solutions the suggestion was made
> > > to edit the
> > > > > myapp.xml file located at 
> CATALINA_HOME/conf/Catalina/localhost/.
> > > > > However, there is no myapp.xml in that directory on my
> > > server. Just 2
> > > > > .xml's related to other applications and a manager.xml
> > > which I'm not
> > > > > sure what it's related to.
> > > > >
> > > > > OS: FC2
> > > > > Tomcat 5.0.28
> > > > >
> > > > > exception: org.apache.commons.dbcp.SWLNestedException:
> > > Cannot create
> > > > > JDBC driver class '' for connect URL 'null'
> > > > >
> > > > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> > > > >         <resource-ref>
> > > > >                 <res-ref-name>jdbc/wms</res-ref-name>
> > > > >                 <res-type>javax.sql.DataSource</res-type>
> > > > >                 <res-auth>Container</res-auth>
> > > > >         </resource-ref>
> > > > >
> > > > > server xml(tried this with and without a Resource name)...
> > > > > <Context path="/wms" docBase="wms" debug="0" 
> reloadable="true">
> > > >
> > > > <Resource name="jdbc/wms" auth="Container"
> > > type="javax.sql.DataSource"/>
> > > >
> > > >
> > > >
> > > > >     <ResourceParams name="jdbc/wms">
> > > > >       <parameter>
> > > > >         <name>username</name>
> > > > >         <value>whatever</value>
> > > > >       </parameter>
> > > > >       <parameter>
> > > > >         <name>password</name>
> > > > >         <value>whatever</value>
> > > > >       </parameter>
> > > > >       <parameter>
> > > > >         <name>driverClassName</name>
> > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > >       </parameter>
> > > > >           <parameter>
> > > > >                 <name>url</name>
> > > > >
> > > <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORM
> > > IXSERVER=serverName</value>
> > > > >         </parameter>
> > > > >     </ResourceParams>
> > > > >   </Context>
> > > > >
> > > > > I have the following jars in my
> > > <CATALINA_HONE>/common/lib and I also
> > > > > tried putting the db driver and commons-collections,
> > > dbcp, and pool in
> > > > > my WEB-INF/lib with no success.  They are all mode 644.
> > > > >
> > > > > ant.jar
> > > > > ant-launcher.jar
> > > > > commons-collections-3.1.jar
> > > > > commons-dbcp-1.2.1.jar
> > > > > commons-el.jar
> > > > > commons-pool-1.2.jar
> > > > > ifxjdbc.jar (the necessary informix driver)
> > > > > jar.txt
> > > > > jasper-compiler.jar
> > > > > jasper-runtime.jar
> > > > > jsp-api.jar
> > > > > mysql-connector-java-3.0.15-ga-bin.jar
> > > > > naming-common.jar
> > > > > naming-factory.jar
> > > > > naming-java.jar
> > > > > naming-resources.jar
> > > > > servlet-api.jar
> > > > >
> > > > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > > > > <at...@gmail.com> wrote:
> > > > > > hi,
> > > > > >  i am not sure but you may try downloading latest 
> jar files for
> > > > > > following froom tomcat site and try them out. copy the
> > > old jar files
> > > > > > somewhere else and try using the latest jar files.
> > > > > > 1) Commons Collections
> > > > > > 2)Commons DBCP
> > > > > > 3)Commons Pool
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff
> > > <ew...@gmail.com> wrote:
> > > > > > > Except that the driver works for connecting if I'm
> > > not utilizing a
> > > > > > > connection pool, i.e., I am able to connect to the db
> > > and manipulate
> > > > > > > data via DriverManager.getConnection(url, db, pwd).
> > > > > > >
> > > > > > > The driver is located in CATALINA_HOME/commons/lib
> > > > > > >
> > > > > > > Eric
> > > > > > >
> > > > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > > > > <ph...@shareowner.com> wrote:
> > > > > > > > No, you don't need that many params. I think your
> > > problem might be the
> > > > > > >
> > > > > > >
> > > > > > > > driver. Where did you drop off your informix jdbc jar?
> > > > > > > >
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > Sent: October 7, 2004 5:56 PM
> > > > > > > > To: Tomcat Users List
> > > > > > > > Subject: Re: connection pooling
> > > > > > > >
> > > > > > > > Yes, I have added <Resource name=... >.  Now
> > > different errors are reported
> > > > > > > > via stack trace as I posted in response to
> > > Atishay's suggestion that I add
> > > > > > > > this.  I'll try adding your suggestions and see
> > > what happens.  Also, you
> > > > > > > > suggest adding many parameters.  Are they necessary
> > > for simply making a
> > > > > > > > connection?  If so, the tutorial I'm following,
> > > 'Tomcat Kick Start' left all
> > > > > > > > your suggestions out.
> > > > > > > > Including the <Resource> tag, but that seems
> > > critical for connection.
> > > > > > > >
> > > > > > > > Eric
> > > > > > > >
> > > > > > > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin
> > > <ph...@shareowner.com>
> > > > > > > > wrote:
> > > > > > > > > 1. web.xml: OK
> > > > > > > > >
> > > > > > > > > 2. context.xml on <context> of server.xml:
> > > > > > > > >
> > > > > > > > >         <Resource name="jdbc/test_connect"
> > > auth="Container"
> > > > > > > > > type="javax.sql.DataSource"/> <= have you added this?
> > > > > > > > >         <ResourceParams name="jdbc/test_connect">
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>driverClassName</name>
> > > > > > > > >                 <value>your.jdbc.driver</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>url</name>
> > > > > > > > >                 <value>your.jdbc.url</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>username</name>
> > > > > > > > >                 <value>youruser</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>password</name>
> > > > > > > > >                 <value>yourpass</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>maxActive</name>
> > > > > > > > >                 <value>20</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>maxIdle</name>
> > > > > > > > >                 <value>10</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>minIdle</name>
> > > > > > > > >                 <value>10</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>maxWait</name>
> > > > > > > > >                 <value>15000</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>removeAbandoned</name>
> > > > > > > > >                 <value>true</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>validationQuery</name>
> > > > > > > > >                 <value>your_query</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>testOnBorrow</name>
> > > > > > > > >                 <value>true</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>testOnReturn</name>
> > > > > > > > >                 <value>true</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 
> <name>minEvictableIdleTimeMillis</name>
> > > > > > > > >                 <value>-1</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <!-- sleeps 5 minutes -->
> > > > > > > > >         <parameter>
> > > > > > > > >                 
> <name>timeBetweenEvictionRunsMillis</name>
> > > > > > > > >                 <value>300000</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>numTestsPerEvictionRun</name>
> > > > > > > > >                 <value>1</value>
> > > > > > > > >         </parameter>
> > > > > > > > >         <parameter>
> > > > > > > > >                 <name>testWhileIdle</name>
> > > > > > > > >                 <value>true</value>
> > > > > > > > >         </parameter>
> > > > > > > > >
> > > > > > > > >         </ResourceParams>
> > > > > > > > >
> > > > > > > > > 3. code
> > > > > > > > >
> > > > > > > > >                 Context initContext = new
> > > InitialContext();
> > > > > > > > >                 Context jdbcContext = (Context)
> > > > > > > > > initContext.lookup("java:comp/env");
> > > > > > > > >                 DataSource dataSource = (DataSource)
> > > > > > > > > jdbcContext.lookup("jdbc/test_connect");
> > > > > > > > >                 ...
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > Sent: October 7, 2004 4:34 PM
> > > > > > > > > To: Tomcat Users List
> > > > > > > > > Subject: Re: connection pooling
> > > > > > > > >
> > > > > > > > > Hi Phillip,
> > > > > > > > >
> > > > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > > > > > > Detail, detail, detail.
> > > > > > > > > >
> > > > > > > > > > 1. your context.xml
> > > > > > > > > > 2. your web.xml
> > > > > > > > > > 3. how do you obtain connection from pool, java
> > > code pls. 4. can you
> > > > > > > > > > connect using pool 5. commons-pool version
> > > > > > > > > >
> > > > > > > > > > Etc. etc.
> > > > > > > > > >
> > > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > >
> > > > > > > > > This was all included in my original post.  Ok,
> > > actually my 2nd post
> > > > > > > > > because I accidentally hit send prior to
> > > completing my post via the
> > > > > > > > > scroll pad on my laptop.  Still, thx for checking
> > > on this and the info
> > > > > > > > > you looking for is copied again here...
> > > > > > > > >
> > > > > > > > > System:
> > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > an Informix Dynamic
> > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > >
> > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > DriverManager.getConnection().  This leads me to
> > > believe that my
> > > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > > CATALINA_HOME/common/lib -I have a Context set up
> > > in my server.xml per
> > > > > > > > > examples in a text tutorial I'm referencing
> > > > > > > > >
> > > > > > > > > Below listed...
> > > > > > > > > -errors
> > > > > > > > > -web.xml
> > > > > > > > > -server.xml <Context> (minus connection actual values)
> > > > > > > > > -.java
> > > > > > > > >
> > > > > > > > > exception/errors:
> > > > > > > > > -Exception:
> > > org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > > > > > > JDBC driver of class '' for connect URL 'null'
> > > SQL state: null Error
> > > > > > > > > code: 0
> > > > > > > > >
> > > > > > > > > -stack trace reveals this, but I can't see why
> > > since I have the driver
> > > > > > > > > in the correct directory...
> > > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > > >
> > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > > >
> > > 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > > > > > > ce.jav
> > > > > > > > > a:773)
> > > > > > > > >
> > > > > > > > > web.xml:
> > > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > > <!DOCTYPE web-app
> > > > > > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> > > Application 2.3//EN"
> > > > > > > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > > <web-app>
> > > > > > > > >        <servlet>
> > > > > > > > >                <servlet-name>Test Connection
> > > Pooling</servlet-name>
> > > > > > > > >
> > > <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > > >        </servlet>
> > > > > > > > >
> > > > > > > > >        <servlet-mapping>
> > > > > > > > >                <servlet-name>Test Connection
> > > Pooling</servlet-name>
> > > > > > > > >
> > > <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > > >        </servlet-mapping>
> > > > > > > > >
> > > > > > > > >        <resource-ref>
> > > > > > > > >          
> <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > > >          <res-type>javax.sql.DataSource</res-type>
> > > > > > > > >          <res-auth>Container</res-auth>
> > > > > > > > >        </resource-ref>
> > > > > > > > > </web-app>
> > > > > > > > >
> > > > > > > > > server.xml <Context>:
> > > > > > > > >  <Context path="/testConnectionPooling"
> > > > > > > > > docBase="testConnectionPooling" debug="0"
> > > reloadable="true">
> > > > > > > > >    <ResourceParams name="jdbc/test_connect">
> > > > > > > > >      <parameter>
> > > > > > > > >        <name>username</name>
> > > > > > > > >        <value>informix</value>
> > > > > > > > >      </parameter>
> > > > > > > > >      <parameter>
> > > > > > > > >        <name>password</name>
> > > > > > > > >        <value>informix</value>
> > > > > > > > >      </parameter>
> > > > > > > > >      <parameter>
> > > > > > > > >        <name>driverClassName</name>
> > > > > > > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > > >      </parameter>
> > > > > > > > >      <parameter>
> > > > > > > > >        <name>url</name>
> > > > > > > > >
> > > 
> <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > > > /value
> > > > > > > > > >
> > > > > > > > >      </parameter>
> > > > > > > > >    </ResourceParams>
> > > > > > > > >  </Context>
> > > > > > > > >
> > > > > > > > > .java:
> > > > > > > > > import java.io.*;
> > > > > > > > > import java.sql.*;
> > > > > > > > > // -Must import javax.naming use JNDI which is
> > > required to implement data
> > > > > > > > > //   resource references and hence connection pooling.
> > > > > > > > > import javax.naming.*;
> > > > > > > > > import javax.sql.*;
> > > > > > > > > import javax.servlet.*;
> > > > > > > > > import javax.servlet.http.*;
> > > > > > > > > import java.util.*;
> > > > > > > > >
> > > > > > > > > public class TestConnectionPooling extends 
> HttpServlet {
> > > > > > > > >        private DataSource dataSource;
> > > > > > > > >
> > > > > > > > >        public void init(ServletConfig config)
> > > throws ServletException {
> > > > > > > > >                try {
> > > > > > > > >                        Context init = new
> > > InitialContext();
> > > > > > > > >                        // don't know what the
> > > 'java:comp/env' refers to
> > > > > > > > >                        Context ctx = (Context)
> > > > > > > > init.lookup("java:comp/env");
> > > > > > > > >                        // I know "jdbc/conversion
> > > must match the
> > > > > > > > > web.xml res-ref-name of the web.xml but don't
> > > know what the path really
> > > > > > > > refers to
> > > > > > > > >                        dataSource = (DataSource)
> > > > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > > >                } catch (NamingException ex) {
> > > > > > > > >                        throw new
> > > ServletException("Cannot retrieve
> > > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > > >                }
> > > > > > > > >        }
> > > > > > > > >
> > > > > > > > >        public void doGet(HttpServletRequest request,
> > > > > > > > > HttpServletResponse
> > > > > > > > > response)
> > > > > > > > >        throws ServletException, IOException {
> > > > > > > > >                response.setContentType("text/html");
> > > > > > > > >                PrintWriter out = response.getWriter();
> > > > > > > > >                Connection connection = null;
> > > > > > > > >                out.println
> > > ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > > >                out.println("<H1>Customer Name
> > > Query</H1>");
> > > > > > > > >
> > > > > > > > >                try {
> > > > > > > > >                        synchronized(dataSource) {
> > > > > > > > >                            connection =
> > > dataSource.getConnection();
> > > > > > > > >                        }
> > > > > > > > >                        out.println("<br>");
> > > > > > > > >
> > > out.println("<strong>Loaded informix driver
> > > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > > >
> > > "Now attempting db
> > > > > > > > > connection.");
> > > > > > > > >                        out.println("<br>");
> > > > > > > > >                        PreparedStatement pstmt =
> > > > > > > > > connection.prepareStatement("SELECT blah FROM 
> blah blah");
> > > > > > > > >                        ResultSet results =
> > > pstmt.executeQuery();
> > > > > > > > >                        if (!results.next()) {
> > > > > > > > >                                throw new
> > > SQLException("No data
> > > > > > > > > returned for some reason");
> > > > > > > > >                        }
> > > > > > > > >                        out.println("<br>");
> > > > > > > > >                        while(results.next()) {
> > > > > > > > >                                
> out.println("<tr><td>" +
> > > > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > > >                        }
> > > > > > > > >        } catch (Exception ex) {
> > > > > > > > >                        out.println("<br>");
> > > > > > > > >                        
> out.println("Exception: " + ex);
> > > > > > > > >                        if(ex instanceof 
> SQLException) {
> > > > > > > > >                                SQLException sqlex
> > > = (SQLException) ex;
> > > > > > > > >                                out.println("<br>");
> > > > > > > > >                                out.println("SQL state:
> > > > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > > >                                out.println("<br>");
> > > > > > > > >                                
> out.println("Error code:
> > > > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > > >                                
> out.println("<br><br>");
> > > > > > > > >                                
> sqlex.printStackTrace(out);
> > > > > > > > >                                
> out.println("<br><br>");
> > > > > > > > >                        }
> > > > > > > > >        }
> > > > > > > > >        finally {
> > > > > > > > >            try { connection.close(); } catch
> > > (Exception ex) {}
> > > > > > > > >        }
> > > > > > > > >                out.println ("</BODY></HTML>");
> > > > > > > > >    }
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > >   ReplyForward
> > > > > > > > >
> > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > java code: Context ctx = (Context)
> > > init.lookup("xxxxxx"); server.xml:
> > > > > > > > > <Resour...
> > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > >
> > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > Please ignore my last post - it's wrong.
> > > (Answered before verifying).
> > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > >
> > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > Is that litterally what you have in your server.xml?
> > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > >
> > > > > > > > > Eric Wulff
> > > > > > > > > No, literally I have the actual values. The same
> > > connection string I
> > > > > > > > > use to s...
> > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > >
> > > > > > > > > jthompson@honda.co.nz
> > > > > > > > > Is there a xxxxx.xml file in
> > > (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > > > > > > where xxx...
> > > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > > >
> > > > > > > > > Eric Wulff
> > > > > > > > > Context name? I assume your referring to the
> > > ResourceParams name
> > > > > > > > > attribute, j...
> > > > > > > > >                  Oct 6 (19 hours ago)
> > > > > > > > >
> > > > > > > > > Phillip Qin
> > > > > > > > > <ph...@shareowner.com> to Tomcat
> > > > > > > > >          More options    6:29am (7 hours ago)
> > > > > > > > > Detail, detail, detail.
> > > > > > > > >
> > > > > > > > > 1. your context.xml
> > > > > > > > > 2. your web.xml
> > > > > > > > > 3. how do you obtain connection from pool, 
> java code pls.
> > > > > > > > > 4. can you connect using pool
> > > > > > > > > 5. commons-pool version
> > > > > > > > >
> > > > > > > > > Etc. etc.
> > > > > > > > >
> > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > > - Show quoted text -
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > > Subject: connection pooling
> > > > > > > > >
> > > > > > > > > Hi all, I have gone over some of the tomcat docs
> > > and googled errors
> > > > > > > > > but there is SO much information covering JNDI
> > > and Datasources... and
> > > > > > > > > I'm hoping I don't have to be a JNDI/Datasource
> > > and XML guru just to
> > > > > > > > > set up db connections via connection pool.
> > > > > > > > >
> > > > > > > > > My situation is this...
> > > > > > > > >
> > > > > > > > > System:
> > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > an Informix Dynamic
> > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > >
> > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > DriverManager.getConnection(). -This leads me to
> > > believe that my jdbc
> > > > > > > > > driver is in the correct place ...CATALINA
> > > > > > > > >
> > > > > > > > >
> > > 
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > For additional commands, e-mail:
> > > tomcat-user-help@jakarta.apache.org
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >   ReplyForwardInvite Phillip to Gmail
> > > > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > > > To:
> > > > > > > > > Cc:
> > > > > > > > > Bcc:
> > > > > > > > >
> > > > > > > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > > > > > > Subject:
> > > > > > > > >
> > > > > > > > > Attach a file
> > > > > > > > >
> > > > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > > >
> > > > > > > > > Atishay Kumar
> > > > > > > > > <at...@gmail.com> to Tomcat, me
> > > > > > > > >          More options    6:47am (6 hours ago)
> > > > > > > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff
> > > <ew...@gmail.com>
> > > > > > > > > wrote:
> > > > > > > > > > I have gone over some of the tomcat docs and
> > > googled errors but
> > > > > > > > > > there is SO much information covering JNDI,
> > > connection pooling, and
> > > > > > > > > > Datasources.  Can someone review the info below
> > > and consult or point
> > > > > > > > > > me in the right direction?  Although I feel I'm
> > > missing something
> > > > > > > > > > obvious, I can't find out what's wrong with 
> my set-up.
> > > > > > > > > >
> > > > > > > > > > thx
> > > > > > > > > > Eric
> > > > > > > > > >
> > > > > > > > > > System:
> > > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > an Informix Dynamic
> > > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > > >
> > > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > > DriverManager.getConnection().  This leads me
> > > to believe that my
> > > > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > > > CATALINA_HOME/common/lib -I have a Context set
> > > up in my server.xml
> > > > > > > > > > per examples in a text tutorial I'm referencing
> > > > > > > > > >
> > > > > > > > > > Below listed...
> > > > > > > > > > -errors
> > > > > > > > > > -web.xml
> > > > > > > > > > -server.xml <Context> (minus connection actual
> > > values) -.java
> > > > > > > > > >
> > > > > > > > > > exception/errors:
> > > > > > > > > > -Exception:
> > > org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > > > > > > create JDBC driver of class '' for connect URL
> > > 'null' SQL state:
> > > > > > > > > > null Error code: 0
> > > > > > > > > >
> > > > > > > > > > -stack trace reveals this, but I can't see why
> > > since I have the
> > > > > > > > > > driver in the correct directory...
> > > > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > > > >
> > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > > > >
> > > 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > > > > > > ur
> > > > > > > > > > ce.java:773)
> > > > > > > > > >
> > > > > > > > > > web.xml:
> > > > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > > > <!DOCTYPE web-app
> > > > > > > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> > > Application 2.3//EN"
> > > > > > > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > > > <web-app>
> > > > > > > > > >         <servlet>
> > > > > > > > > >                 <servlet-name>Test Connection
> > > Pooling</servlet-name>
> > > > > > > > > >
> > > <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > > > >         </servlet>
> > > > > > > > > >
> > > > > > > > > >         <servlet-mapping>
> > > > > > > > > >                 <servlet-name>Test Connection
> > > Pooling</servlet-name>
> > > > > > > > > >
> > > <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > > > >         </servlet-mapping>
> > > > > > > > > >
> > > > > > > > > >         <resource-ref>
> > > > > > > > > >           
> <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > > > > > > >           <res-auth>Container</res-auth>
> > > > > > > > > >         </resource-ref>
> > > > > > > > > > </web-app>
> > > > > > > > > >
> > > > > > > > > > server.xml <Context>:
> > > > > > > > > >   <Context path="/testConnectionPooling"
> > > > > > > > > > docBase="testConnectionPooling" debug="0"
> > > reloadable="true">
> > > > > > > > >
> > > > > > > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > > > > > > type="javax.sql.DataSource"/> is missing
> > > > > > > > >
> > > > > > > > > >     <ResourceParams name="jdbc/test_connect">
> > > > > > > > > >       <parameter>
> > > > > > > > > >         <name>username</name>
> > > > > > > > > >         <value>informix</value>
> > > > > > > > > >       </parameter>
> > > > > > > > > >       <parameter>
> > > > > > > > > >         <name>password</name>
> > > > > > > > > >         <value>informix</value>
> > > > > > > > > >       </parameter>
> > > > > > > > > >       <parameter>
> > > > > > > > > >         <name>driverClassName</name>
> > > > > > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > > > >       </parameter>
> > > > > > > > > >       <parameter>
> > > > > > > > > >         <name>url</name>
> > > > > > > > > >
> > > > > > > > >
> > > 
> <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > > > /value
> > > > > > > > > >
> > > > > > > > > >       </parameter>
> > > > > > > > > >     </ResourceParams>
> > > > > > > > > >   </Context>
> > > > > > > > > >
> > > > > > > > > > .java:
> > > > > > > > > > import java.io.*;
> > > > > > > > > > import java.sql.*;
> > > > > > > > > > // -Must import javax.naming use JNDI which is
> > > required to implement
> > > > > > > > data
> > > > > > > > > > //   resource references and hence 
> connection pooling.
> > > > > > > > > > import javax.naming.*;
> > > > > > > > > > import javax.sql.*;
> > > > > > > > > > import javax.servlet.*;
> > > > > > > > > > import javax.servlet.http.*;
> > > > > > > > > > import java.util.*;
> > > > > > > > > >
> > > > > > > > > > public class TestConnectionPooling extends 
> HttpServlet {
> > > > > > > > > >         private DataSource dataSource;
> > > > > > > > > >
> > > > > > > > > >         public void init(ServletConfig config)
> > > throws ServletException {
> > > > > > > > > >                 try {
> > > > > > > > > >                         Context init = new
> > > InitialContext();
> > > > > > > > > >                         // don't know what the
> > > 'java:comp/env' refers to
> > > > > > > > > >                         Context ctx = (Context)
> > > > > > > > > init.lookup("java:comp/env");
> > > > > > > > > >                         // I know
> > > "jdbc/conversion must match the
> > > > > > > > > > web.xml res-ref-name of the web.xml but don't
> > > know what the path
> > > > > > > > > > really
> > > > > > > > > refers to
> > > > > > > > > >                         dataSource = (DataSource)
> > > > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > > > >                 } catch (NamingException ex) {
> > > > > > > > > >                         throw new
> > > ServletException("Cannot retrieve
> > > > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > > > >                 }
> > > > > > > > > >         }
> > > > > > > > > >
> > > > > > > > > >         public void 
> doGet(HttpServletRequest request,
> > > > > > > > > > HttpServletResponse
> > > > > > > > > response)
> > > > > > > > > >         throws ServletException, IOException {
> > > > > > > > > >                 
> response.setContentType("text/html");
> > > > > > > > > >                 PrintWriter out = 
> response.getWriter();
> > > > > > > > > >                 Connection connection = null;
> > > > > > > > > >                 out.println
> > > ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > > > >                 out.println("<H1>Customer Name
> > > Query</H1>");
> > > > > > > > > >
> > > > > > > > > >                 try {
> > > > > > > > > >                         synchronized(dataSource) {
> > > > > > > > > >                             connection =
> > > dataSource.getConnection();
> > > > > > > > > >                         }
> > > > > > > > > >                         out.println("<br>");
> > > > > > > > > >
> > > out.println("<strong>Loaded informix driver
> > > > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > > > >
> > > "Now attempting db
> > > > > > > > > connection.");
> > > > > > > > > >                         out.println("<br>");
> > > > > > > > > >                         PreparedStatement pstmt =
> > > > > > > > > > connection.prepareStatement("SELECT blah FROM
> > > blah blah");
> > > > > > > > > >                         ResultSet results =
> > > pstmt.executeQuery();
> > > > > > > > > >                         if (!results.next()) {
> > > > > > > > > >                                 throw new
> > > SQLException("No data
> > > > > > > > > > returned
> > > > > > > > > for some reason");
> > > > > > > > > >                         }
> > > > > > > > > >                         out.println("<br>");
> > > > > > > > > >                         while(results.next()) {
> > > > > > > > > >                                 
> out.println("<tr><td>" +
> > > > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > > > >                         }
> > > > > > > > > >         } catch (Exception ex) {
> > > > > > > > > >                         out.println("<br>");
> > > > > > > > > >                         
> out.println("Exception: " + ex);
> > > > > > > > > >                         if(ex instanceof 
> SQLException) {
> > > > > > > > > >                                 SQLException
> > > sqlex = (SQLException) ex;
> > > > > > > > > >                                 out.println("<br>");
> > > > > > > > > >                                 
> out.println("SQL state:
> > > > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > > > >                                 out.println("<br>");
> > > > > > > > > >                                 
> out.println("Error code:
> > > > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > > > >                                 
> out.println("<br><br>");
> > > > > > > > > >
> > > sqlex.printStackTrace(out);
> > > > > > > > > >                                 
> out.println("<br><br>");
> > > > > > > > > >                         }
> > > > > > > > > >         }
> > > > > > > > > >         finally {
> > > > > > > > > >             try { connection.close(); } catch
> > > (Exception ex) {}
> > > > > > > > > >         }
> > > > > > > > > >                 out.println ("</BODY></HTML>");
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >     }
> > > > > > > > > > }
> > > > > > > > >
> > > > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > > > > > > <ph...@shareowner.com>
> > > > > > > > > wrote:
> > > > > > > > > > Detail, detail, detail.
> > > > > > > > > >
> > > > > > > > > > 1. your context.xml
> > > > > > > > > > 2. your web.xml
> > > > > > > > > > 3. how do you obtain connection from pool, java
> > > code pls. 4. can you
> > > > > > > > > > connect using pool 5. commons-pool version
> > > > > > > > > >
> > > > > > > > > > Etc. etc.
> > > > > > > > > >
> > > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > -----Original Message-----
> > > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > > > Subject: connection pooling
> > > > > > > > > >
> > > > > > > > > > Hi all, I have gone over some of the tomcat
> > > docs and googled errors
> > > > > > > > > > but there is SO much information covering JNDI
> > > and Datasources...
> > > > > > > > > > and I'm hoping I don't have to be a
> > > JNDI/Datasource and XML guru
> > > > > > > > > > just to set up db connections via connection pool.
> > > > > > > > > >
> > > > > > > > > > My situation is this...
> > > > > > > > > >
> > > > > > > > > > System:
> > > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > > an Informix Dynamic
> > > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > > >
> > > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > > DriverManager.getConnection(). -This leads me
> > > to believe that my
> > > > > > > > > > jdbc driver is in the correct place ...CATALINA
> > > > > > > > > >
> > > > > > > > > >
> > > 
> --------------------------------------------------------------------
> > > > > > > > > > -
> > > > > > > > > > To unsubscribe, e-mail:
> > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > > For additional commands, e-mail:
> > > tomcat-user-help@jakarta.apache.org
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > 
> ---------------------------------------------------------------------
> > > > > > > > > To unsubscribe, e-mail:
> > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > For additional commands, e-mail:
> > > tomcat-user-help@jakarta.apache.org
> > > > > > > > >
> > > > > > > > > !DSPAM:4165a84c9322136420805!
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > 
> ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > For additional commands, e-mail:
> > > tomcat-user-help@jakarta.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > > > !DSPAM:4165bb7715701366110907!
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > 
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > For additional commands, e-mail:
> > > tomcat-user-help@jakarta.apache.org
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > >
> > > > > > :)
> > > > > > Atishay Kumar
> > > > > > Btech, SEM VII
> > > > > > DA-IICT
> > > > > > Gandhinagar - 382009
> > > > > > India
> > > > > > ph: +91 9825383948
> > > > > >
> > > /*************************************************************
> > > ***************
> > > > > >  * Learn the rules as you would need them to break them
> > > properly *
> > > > > >
> > > **************************************************************
> > > **************/
> > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > :)
> > > > Atishay Kumar
> > > > Btech, SEM VII
> > > > DA-IICT
> > > > Gandhinagar - 382009
> > > > India
> > > > ph: +91 9825383948
> > > >
> > > /*************************************************************
> > > ***************
> > > >  * Learn the rules as you would need them to break them 
> properly *
> > > >
> > > **************************************************************
> > > **************/
> > > >
> > > >
> > > 
> ---------------------------------------------------------------------
> > > >
> > > >
> > > > To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > >
> > > >
> > > 
> > > 
> ---------------------------------------------------------------------
> > 
> > 
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > >
> > >
> > 
> >
> 



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


Re: connection pooling

Posted by Eric Wulff <ew...@gmail.com>.
Steve, I am trying to use DBCP(hence the subject of the thread) and I
believe I have a driver that supports it.  Especially considering that
the connection works when I wrap my data resource in a DefaultContext
tag inside a stand alone Engine tag(server.xml), instead of inside a
Context tag(how all instructions I've followed so far suggest).

This means my driver support DBCP, correct?

The only source code I imagine would help is the code I use to gain
connection...

Context initialContext = new InitialContext();
Context context = (Context) initialContext.lookup("java:comp/env");
DataSource dataSource = (DataSource) context.lookup("jdbc/wms");
connection = dataSource.getConnection();

I have seen no mention of this factory class parameter you speak of. 
I'm using TC 5.0.28.  I'll try it.

thx much for your help
Eric


On Fri, 5 Nov 2004 13:30:35 -0000, Steve Kirk
<to...@web-startup.co.uk> wrote:
> Eric - you are correct,  you do not need both <resource-ref> and <Resource>
> (although I've found that having both does not cause a problem).
> 
> Back to your problem.
> 
> The error message indicates that TC cannot find the Resource.
> 
> I'm not sure if you are trying to use DBCP or not (in other words, does the
> informix driver support pooling on its own, or do you in fact need DBCP or
> some other implementation wrapped around it)?  You have
> <res-type>javax.sql.DataSource</res-type> but do not list the factory class
> under your Resource, e.g. :
> <parameter>
>         <name>factory</name>
>         <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> </parameter>
> 
> I have not seen any Java source code on this thread, maybe you posted it
> before I started reading it.
> 
> Thinking slightly laterally I'll pass on something I learned from Yoav
> recently on this list.... you don't need to use container-managed resources
> to do connection pooling.  In other words you don't need to set any Resource
> or Context to get it to work.
> 
> 
> 
> > -----Original Message-----
> > From: Eric Wulff [mailto:ewulff@gmail.com]
> > Sent: Friday 05 November 2004 05:57
> > To: Tomcat Users List; Atishay Kumar
> > Subject: Re: connection pooling
> >
> >
> > Thx for your input but, as mentioned in my previous message, I've
> > tried this and it does not work.  Also, considering my web.xml I
> > shouldn't need this, correct?  I have a <resource-ref> in my web.xml.
> >
> > Eric
> >
> >
> > On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar
> > <at...@gmail.com> wrote:
> > >
> > > Pls do the following change after <context......> and u are on!!
> > > cheers
> > >
> > >
> > > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff
> > <ew...@gmail.com> wrote:
> > > > Hi all, I'm returning to a problem I couldn't solve the
> > first time,
> > > > about two months ago, and still can't seem to figure out.
> >  I can't get
> > > > a db connection using connection pools.  I get the
> > exception listed
> > > > below, same as so many have previously, but nothing I've
> > found seems
> > > > to works.  Below are my specs.  Anyone with concrete
> > advise/direction
> > > > on how to get
> > > > this working?
> > > >
> > > > Also, I noticed in many solutions the suggestion was made
> > to edit the
> > > > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> > > > However, there is no myapp.xml in that directory on my
> > server. Just 2
> > > > .xml's related to other applications and a manager.xml
> > which I'm not
> > > > sure what it's related to.
> > > >
> > > > OS: FC2
> > > > Tomcat 5.0.28
> > > >
> > > > exception: org.apache.commons.dbcp.SWLNestedException:
> > Cannot create
> > > > JDBC driver class '' for connect URL 'null'
> > > >
> > > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> > > >         <resource-ref>
> > > >                 <res-ref-name>jdbc/wms</res-ref-name>
> > > >                 <res-type>javax.sql.DataSource</res-type>
> > > >                 <res-auth>Container</res-auth>
> > > >         </resource-ref>
> > > >
> > > > server xml(tried this with and without a Resource name)...
> > > > <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> > >
> > > <Resource name="jdbc/wms" auth="Container"
> > type="javax.sql.DataSource"/>
> > >
> > >
> > >
> > > >     <ResourceParams name="jdbc/wms">
> > > >       <parameter>
> > > >         <name>username</name>
> > > >         <value>whatever</value>
> > > >       </parameter>
> > > >       <parameter>
> > > >         <name>password</name>
> > > >         <value>whatever</value>
> > > >       </parameter>
> > > >       <parameter>
> > > >         <name>driverClassName</name>
> > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > >       </parameter>
> > > >           <parameter>
> > > >                 <name>url</name>
> > > >
> > <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORM
> > IXSERVER=serverName</value>
> > > >         </parameter>
> > > >     </ResourceParams>
> > > >   </Context>
> > > >
> > > > I have the following jars in my
> > <CATALINA_HONE>/common/lib and I also
> > > > tried putting the db driver and commons-collections,
> > dbcp, and pool in
> > > > my WEB-INF/lib with no success.  They are all mode 644.
> > > >
> > > > ant.jar
> > > > ant-launcher.jar
> > > > commons-collections-3.1.jar
> > > > commons-dbcp-1.2.1.jar
> > > > commons-el.jar
> > > > commons-pool-1.2.jar
> > > > ifxjdbc.jar (the necessary informix driver)
> > > > jar.txt
> > > > jasper-compiler.jar
> > > > jasper-runtime.jar
> > > > jsp-api.jar
> > > > mysql-connector-java-3.0.15-ga-bin.jar
> > > > naming-common.jar
> > > > naming-factory.jar
> > > > naming-java.jar
> > > > naming-resources.jar
> > > > servlet-api.jar
> > > >
> > > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > > > <at...@gmail.com> wrote:
> > > > > hi,
> > > > >  i am not sure but you may try downloading latest jar files for
> > > > > following froom tomcat site and try them out. copy the
> > old jar files
> > > > > somewhere else and try using the latest jar files.
> > > > > 1) Commons Collections
> > > > > 2)Commons DBCP
> > > > > 3)Commons Pool
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff
> > <ew...@gmail.com> wrote:
> > > > > > Except that the driver works for connecting if I'm
> > not utilizing a
> > > > > > connection pool, i.e., I am able to connect to the db
> > and manipulate
> > > > > > data via DriverManager.getConnection(url, db, pwd).
> > > > > >
> > > > > > The driver is located in CATALINA_HOME/commons/lib
> > > > > >
> > > > > > Eric
> > > > > >
> > > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > > > <ph...@shareowner.com> wrote:
> > > > > > > No, you don't need that many params. I think your
> > problem might be the
> > > > > >
> > > > > >
> > > > > > > driver. Where did you drop off your informix jdbc jar?
> > > > > > >
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > Sent: October 7, 2004 5:56 PM
> > > > > > > To: Tomcat Users List
> > > > > > > Subject: Re: connection pooling
> > > > > > >
> > > > > > > Yes, I have added <Resource name=... >.  Now
> > different errors are reported
> > > > > > > via stack trace as I posted in response to
> > Atishay's suggestion that I add
> > > > > > > this.  I'll try adding your suggestions and see
> > what happens.  Also, you
> > > > > > > suggest adding many parameters.  Are they necessary
> > for simply making a
> > > > > > > connection?  If so, the tutorial I'm following,
> > 'Tomcat Kick Start' left all
> > > > > > > your suggestions out.
> > > > > > > Including the <Resource> tag, but that seems
> > critical for connection.
> > > > > > >
> > > > > > > Eric
> > > > > > >
> > > > > > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin
> > <ph...@shareowner.com>
> > > > > > > wrote:
> > > > > > > > 1. web.xml: OK
> > > > > > > >
> > > > > > > > 2. context.xml on <context> of server.xml:
> > > > > > > >
> > > > > > > >         <Resource name="jdbc/test_connect"
> > auth="Container"
> > > > > > > > type="javax.sql.DataSource"/> <= have you added this?
> > > > > > > >         <ResourceParams name="jdbc/test_connect">
> > > > > > > >         <parameter>
> > > > > > > >                 <name>driverClassName</name>
> > > > > > > >                 <value>your.jdbc.driver</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>url</name>
> > > > > > > >                 <value>your.jdbc.url</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>username</name>
> > > > > > > >                 <value>youruser</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>password</name>
> > > > > > > >                 <value>yourpass</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>maxActive</name>
> > > > > > > >                 <value>20</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>maxIdle</name>
> > > > > > > >                 <value>10</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>minIdle</name>
> > > > > > > >                 <value>10</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>maxWait</name>
> > > > > > > >                 <value>15000</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>removeAbandoned</name>
> > > > > > > >                 <value>true</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>validationQuery</name>
> > > > > > > >                 <value>your_query</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>testOnBorrow</name>
> > > > > > > >                 <value>true</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>testOnReturn</name>
> > > > > > > >                 <value>true</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>minEvictableIdleTimeMillis</name>
> > > > > > > >                 <value>-1</value>
> > > > > > > >         </parameter>
> > > > > > > >         <!-- sleeps 5 minutes -->
> > > > > > > >         <parameter>
> > > > > > > >                 <name>timeBetweenEvictionRunsMillis</name>
> > > > > > > >                 <value>300000</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>numTestsPerEvictionRun</name>
> > > > > > > >                 <value>1</value>
> > > > > > > >         </parameter>
> > > > > > > >         <parameter>
> > > > > > > >                 <name>testWhileIdle</name>
> > > > > > > >                 <value>true</value>
> > > > > > > >         </parameter>
> > > > > > > >
> > > > > > > >         </ResourceParams>
> > > > > > > >
> > > > > > > > 3. code
> > > > > > > >
> > > > > > > >                 Context initContext = new
> > InitialContext();
> > > > > > > >                 Context jdbcContext = (Context)
> > > > > > > > initContext.lookup("java:comp/env");
> > > > > > > >                 DataSource dataSource = (DataSource)
> > > > > > > > jdbcContext.lookup("jdbc/test_connect");
> > > > > > > >                 ...
> > > > > > > >
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > Sent: October 7, 2004 4:34 PM
> > > > > > > > To: Tomcat Users List
> > > > > > > > Subject: Re: connection pooling
> > > > > > > >
> > > > > > > > Hi Phillip,
> > > > > > > >
> > > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > > > > > Detail, detail, detail.
> > > > > > > > >
> > > > > > > > > 1. your context.xml
> > > > > > > > > 2. your web.xml
> > > > > > > > > 3. how do you obtain connection from pool, java
> > code pls. 4. can you
> > > > > > > > > connect using pool 5. commons-pool version
> > > > > > > > >
> > > > > > > > > Etc. etc.
> > > > > > > > >
> > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > >
> > > > > > > > This was all included in my original post.  Ok,
> > actually my 2nd post
> > > > > > > > because I accidentally hit send prior to
> > completing my post via the
> > > > > > > > scroll pad on my laptop.  Still, thx for checking
> > on this and the info
> > > > > > > > you looking for is copied again here...
> > > > > > > >
> > > > > > > > System:
> > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > an Informix Dynamic
> > > > > > > > Server 9.4 on Windows Server
> > > > > > > >
> > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > DriverManager.getConnection().  This leads me to
> > believe that my
> > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > CATALINA_HOME/common/lib -I have a Context set up
> > in my server.xml per
> > > > > > > > examples in a text tutorial I'm referencing
> > > > > > > >
> > > > > > > > Below listed...
> > > > > > > > -errors
> > > > > > > > -web.xml
> > > > > > > > -server.xml <Context> (minus connection actual values)
> > > > > > > > -.java
> > > > > > > >
> > > > > > > > exception/errors:
> > > > > > > > -Exception:
> > org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > > > > > JDBC driver of class '' for connect URL 'null'
> > SQL state: null Error
> > > > > > > > code: 0
> > > > > > > >
> > > > > > > > -stack trace reveals this, but I can't see why
> > since I have the driver
> > > > > > > > in the correct directory...
> > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > >
> > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > >
> > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > > > > > ce.jav
> > > > > > > > a:773)
> > > > > > > >
> > > > > > > > web.xml:
> > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > <!DOCTYPE web-app
> > > > > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> > Application 2.3//EN"
> > > > > > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > <web-app>
> > > > > > > >        <servlet>
> > > > > > > >                <servlet-name>Test Connection
> > Pooling</servlet-name>
> > > > > > > >
> > <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > >        </servlet>
> > > > > > > >
> > > > > > > >        <servlet-mapping>
> > > > > > > >                <servlet-name>Test Connection
> > Pooling</servlet-name>
> > > > > > > >
> > <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > >        </servlet-mapping>
> > > > > > > >
> > > > > > > >        <resource-ref>
> > > > > > > >          <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > >          <res-type>javax.sql.DataSource</res-type>
> > > > > > > >          <res-auth>Container</res-auth>
> > > > > > > >        </resource-ref>
> > > > > > > > </web-app>
> > > > > > > >
> > > > > > > > server.xml <Context>:
> > > > > > > >  <Context path="/testConnectionPooling"
> > > > > > > > docBase="testConnectionPooling" debug="0"
> > reloadable="true">
> > > > > > > >    <ResourceParams name="jdbc/test_connect">
> > > > > > > >      <parameter>
> > > > > > > >        <name>username</name>
> > > > > > > >        <value>informix</value>
> > > > > > > >      </parameter>
> > > > > > > >      <parameter>
> > > > > > > >        <name>password</name>
> > > > > > > >        <value>informix</value>
> > > > > > > >      </parameter>
> > > > > > > >      <parameter>
> > > > > > > >        <name>driverClassName</name>
> > > > > > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > >      </parameter>
> > > > > > > >      <parameter>
> > > > > > > >        <name>url</name>
> > > > > > > >
> > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > > /value
> > > > > > > > >
> > > > > > > >      </parameter>
> > > > > > > >    </ResourceParams>
> > > > > > > >  </Context>
> > > > > > > >
> > > > > > > > .java:
> > > > > > > > import java.io.*;
> > > > > > > > import java.sql.*;
> > > > > > > > // -Must import javax.naming use JNDI which is
> > required to implement data
> > > > > > > > //   resource references and hence connection pooling.
> > > > > > > > import javax.naming.*;
> > > > > > > > import javax.sql.*;
> > > > > > > > import javax.servlet.*;
> > > > > > > > import javax.servlet.http.*;
> > > > > > > > import java.util.*;
> > > > > > > >
> > > > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > > > >        private DataSource dataSource;
> > > > > > > >
> > > > > > > >        public void init(ServletConfig config)
> > throws ServletException {
> > > > > > > >                try {
> > > > > > > >                        Context init = new
> > InitialContext();
> > > > > > > >                        // don't know what the
> > 'java:comp/env' refers to
> > > > > > > >                        Context ctx = (Context)
> > > > > > > init.lookup("java:comp/env");
> > > > > > > >                        // I know "jdbc/conversion
> > must match the
> > > > > > > > web.xml res-ref-name of the web.xml but don't
> > know what the path really
> > > > > > > refers to
> > > > > > > >                        dataSource = (DataSource)
> > > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > >                } catch (NamingException ex) {
> > > > > > > >                        throw new
> > ServletException("Cannot retrieve
> > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > >                }
> > > > > > > >        }
> > > > > > > >
> > > > > > > >        public void doGet(HttpServletRequest request,
> > > > > > > > HttpServletResponse
> > > > > > > > response)
> > > > > > > >        throws ServletException, IOException {
> > > > > > > >                response.setContentType("text/html");
> > > > > > > >                PrintWriter out = response.getWriter();
> > > > > > > >                Connection connection = null;
> > > > > > > >                out.println
> > ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > >                out.println("<H1>Customer Name
> > Query</H1>");
> > > > > > > >
> > > > > > > >                try {
> > > > > > > >                        synchronized(dataSource) {
> > > > > > > >                            connection =
> > dataSource.getConnection();
> > > > > > > >                        }
> > > > > > > >                        out.println("<br>");
> > > > > > > >
> > out.println("<strong>Loaded informix driver
> > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > >
> > "Now attempting db
> > > > > > > > connection.");
> > > > > > > >                        out.println("<br>");
> > > > > > > >                        PreparedStatement pstmt =
> > > > > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > > > > >                        ResultSet results =
> > pstmt.executeQuery();
> > > > > > > >                        if (!results.next()) {
> > > > > > > >                                throw new
> > SQLException("No data
> > > > > > > > returned for some reason");
> > > > > > > >                        }
> > > > > > > >                        out.println("<br>");
> > > > > > > >                        while(results.next()) {
> > > > > > > >                                out.println("<tr><td>" +
> > > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > >                        }
> > > > > > > >        } catch (Exception ex) {
> > > > > > > >                        out.println("<br>");
> > > > > > > >                        out.println("Exception: " + ex);
> > > > > > > >                        if(ex instanceof SQLException) {
> > > > > > > >                                SQLException sqlex
> > = (SQLException) ex;
> > > > > > > >                                out.println("<br>");
> > > > > > > >                                out.println("SQL state:
> > > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > >                                out.println("<br>");
> > > > > > > >                                out.println("Error code:
> > > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > >                                out.println("<br><br>");
> > > > > > > >                                sqlex.printStackTrace(out);
> > > > > > > >                                out.println("<br><br>");
> > > > > > > >                        }
> > > > > > > >        }
> > > > > > > >        finally {
> > > > > > > >            try { connection.close(); } catch
> > (Exception ex) {}
> > > > > > > >        }
> > > > > > > >                out.println ("</BODY></HTML>");
> > > > > > > >    }
> > > > > > > > }
> > > > > > > >
> > > > > > > >   ReplyForward
> > > > > > > >
> > > > > > > > jthompson@honda.co.nz
> > > > > > > > java code: Context ctx = (Context)
> > init.lookup("xxxxxx"); server.xml:
> > > > > > > > <Resour...
> > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > >
> > > > > > > > jthompson@honda.co.nz
> > > > > > > > Please ignore my last post - it's wrong.
> > (Answered before verifying).
> > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > >
> > > > > > > > jthompson@honda.co.nz
> > > > > > > > Is that litterally what you have in your server.xml?
> > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > >
> > > > > > > > Eric Wulff
> > > > > > > > No, literally I have the actual values. The same
> > connection string I
> > > > > > > > use to s...
> > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > >
> > > > > > > > jthompson@honda.co.nz
> > > > > > > > Is there a xxxxx.xml file in
> > (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > > > > > where xxx...
> > > > > > > >                  Oct 6 (22 hours ago)
> > > > > > > >
> > > > > > > > Eric Wulff
> > > > > > > > Context name? I assume your referring to the
> > ResourceParams name
> > > > > > > > attribute, j...
> > > > > > > >                  Oct 6 (19 hours ago)
> > > > > > > >
> > > > > > > > Phillip Qin
> > > > > > > > <ph...@shareowner.com> to Tomcat
> > > > > > > >          More options    6:29am (7 hours ago)
> > > > > > > > Detail, detail, detail.
> > > > > > > >
> > > > > > > > 1. your context.xml
> > > > > > > > 2. your web.xml
> > > > > > > > 3. how do you obtain connection from pool, java code pls.
> > > > > > > > 4. can you connect using pool
> > > > > > > > 5. commons-pool version
> > > > > > > >
> > > > > > > > Etc. etc.
> > > > > > > >
> > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > - Show quoted text -
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > Subject: connection pooling
> > > > > > > >
> > > > > > > > Hi all, I have gone over some of the tomcat docs
> > and googled errors
> > > > > > > > but there is SO much information covering JNDI
> > and Datasources... and
> > > > > > > > I'm hoping I don't have to be a JNDI/Datasource
> > and XML guru just to
> > > > > > > > set up db connections via connection pool.
> > > > > > > >
> > > > > > > > My situation is this...
> > > > > > > >
> > > > > > > > System:
> > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > an Informix Dynamic
> > > > > > > > Server 9.4 on Windows Server
> > > > > > > >
> > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > DriverManager.getConnection(). -This leads me to
> > believe that my jdbc
> > > > > > > > driver is in the correct place ...CATALINA
> > > > > > > >
> > > > > > > >
> > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > > >   ReplyForwardInvite Phillip to Gmail
> > > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > > To:
> > > > > > > > Cc:
> > > > > > > > Bcc:
> > > > > > > >
> > > > > > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > > > > > Subject:
> > > > > > > >
> > > > > > > > Attach a file
> > > > > > > >
> > > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > >
> > > > > > > > Atishay Kumar
> > > > > > > > <at...@gmail.com> to Tomcat, me
> > > > > > > >          More options    6:47am (6 hours ago)
> > > > > > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff
> > <ew...@gmail.com>
> > > > > > > > wrote:
> > > > > > > > > I have gone over some of the tomcat docs and
> > googled errors but
> > > > > > > > > there is SO much information covering JNDI,
> > connection pooling, and
> > > > > > > > > Datasources.  Can someone review the info below
> > and consult or point
> > > > > > > > > me in the right direction?  Although I feel I'm
> > missing something
> > > > > > > > > obvious, I can't find out what's wrong with my set-up.
> > > > > > > > >
> > > > > > > > > thx
> > > > > > > > > Eric
> > > > > > > > >
> > > > > > > > > System:
> > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > an Informix Dynamic
> > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > >
> > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > DriverManager.getConnection().  This leads me
> > to believe that my
> > > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > > CATALINA_HOME/common/lib -I have a Context set
> > up in my server.xml
> > > > > > > > > per examples in a text tutorial I'm referencing
> > > > > > > > >
> > > > > > > > > Below listed...
> > > > > > > > > -errors
> > > > > > > > > -web.xml
> > > > > > > > > -server.xml <Context> (minus connection actual
> > values) -.java
> > > > > > > > >
> > > > > > > > > exception/errors:
> > > > > > > > > -Exception:
> > org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > > > > > create JDBC driver of class '' for connect URL
> > 'null' SQL state:
> > > > > > > > > null Error code: 0
> > > > > > > > >
> > > > > > > > > -stack trace reveals this, but I can't see why
> > since I have the
> > > > > > > > > driver in the correct directory...
> > > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > > >
> > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > > >
> > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > > > > > ur
> > > > > > > > > ce.java:773)
> > > > > > > > >
> > > > > > > > > web.xml:
> > > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > > <!DOCTYPE web-app
> > > > > > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web
> > Application 2.3//EN"
> > > > > > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > > <web-app>
> > > > > > > > >         <servlet>
> > > > > > > > >                 <servlet-name>Test Connection
> > Pooling</servlet-name>
> > > > > > > > >
> > <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > > >         </servlet>
> > > > > > > > >
> > > > > > > > >         <servlet-mapping>
> > > > > > > > >                 <servlet-name>Test Connection
> > Pooling</servlet-name>
> > > > > > > > >
> > <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > > >         </servlet-mapping>
> > > > > > > > >
> > > > > > > > >         <resource-ref>
> > > > > > > > >           <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > > > > > >           <res-auth>Container</res-auth>
> > > > > > > > >         </resource-ref>
> > > > > > > > > </web-app>
> > > > > > > > >
> > > > > > > > > server.xml <Context>:
> > > > > > > > >   <Context path="/testConnectionPooling"
> > > > > > > > > docBase="testConnectionPooling" debug="0"
> > reloadable="true">
> > > > > > > >
> > > > > > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > > > > > type="javax.sql.DataSource"/> is missing
> > > > > > > >
> > > > > > > > >     <ResourceParams name="jdbc/test_connect">
> > > > > > > > >       <parameter>
> > > > > > > > >         <name>username</name>
> > > > > > > > >         <value>informix</value>
> > > > > > > > >       </parameter>
> > > > > > > > >       <parameter>
> > > > > > > > >         <name>password</name>
> > > > > > > > >         <value>informix</value>
> > > > > > > > >       </parameter>
> > > > > > > > >       <parameter>
> > > > > > > > >         <name>driverClassName</name>
> > > > > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > > >       </parameter>
> > > > > > > > >       <parameter>
> > > > > > > > >         <name>url</name>
> > > > > > > > >
> > > > > > > >
> > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > > /value
> > > > > > > > >
> > > > > > > > >       </parameter>
> > > > > > > > >     </ResourceParams>
> > > > > > > > >   </Context>
> > > > > > > > >
> > > > > > > > > .java:
> > > > > > > > > import java.io.*;
> > > > > > > > > import java.sql.*;
> > > > > > > > > // -Must import javax.naming use JNDI which is
> > required to implement
> > > > > > > data
> > > > > > > > > //   resource references and hence connection pooling.
> > > > > > > > > import javax.naming.*;
> > > > > > > > > import javax.sql.*;
> > > > > > > > > import javax.servlet.*;
> > > > > > > > > import javax.servlet.http.*;
> > > > > > > > > import java.util.*;
> > > > > > > > >
> > > > > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > > > > >         private DataSource dataSource;
> > > > > > > > >
> > > > > > > > >         public void init(ServletConfig config)
> > throws ServletException {
> > > > > > > > >                 try {
> > > > > > > > >                         Context init = new
> > InitialContext();
> > > > > > > > >                         // don't know what the
> > 'java:comp/env' refers to
> > > > > > > > >                         Context ctx = (Context)
> > > > > > > > init.lookup("java:comp/env");
> > > > > > > > >                         // I know
> > "jdbc/conversion must match the
> > > > > > > > > web.xml res-ref-name of the web.xml but don't
> > know what the path
> > > > > > > > > really
> > > > > > > > refers to
> > > > > > > > >                         dataSource = (DataSource)
> > > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > > >                 } catch (NamingException ex) {
> > > > > > > > >                         throw new
> > ServletException("Cannot retrieve
> > > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > > >                 }
> > > > > > > > >         }
> > > > > > > > >
> > > > > > > > >         public void doGet(HttpServletRequest request,
> > > > > > > > > HttpServletResponse
> > > > > > > > response)
> > > > > > > > >         throws ServletException, IOException {
> > > > > > > > >                 response.setContentType("text/html");
> > > > > > > > >                 PrintWriter out = response.getWriter();
> > > > > > > > >                 Connection connection = null;
> > > > > > > > >                 out.println
> > ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > > >                 out.println("<H1>Customer Name
> > Query</H1>");
> > > > > > > > >
> > > > > > > > >                 try {
> > > > > > > > >                         synchronized(dataSource) {
> > > > > > > > >                             connection =
> > dataSource.getConnection();
> > > > > > > > >                         }
> > > > > > > > >                         out.println("<br>");
> > > > > > > > >
> > out.println("<strong>Loaded informix driver
> > > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > > >
> > "Now attempting db
> > > > > > > > connection.");
> > > > > > > > >                         out.println("<br>");
> > > > > > > > >                         PreparedStatement pstmt =
> > > > > > > > > connection.prepareStatement("SELECT blah FROM
> > blah blah");
> > > > > > > > >                         ResultSet results =
> > pstmt.executeQuery();
> > > > > > > > >                         if (!results.next()) {
> > > > > > > > >                                 throw new
> > SQLException("No data
> > > > > > > > > returned
> > > > > > > > for some reason");
> > > > > > > > >                         }
> > > > > > > > >                         out.println("<br>");
> > > > > > > > >                         while(results.next()) {
> > > > > > > > >                                 out.println("<tr><td>" +
> > > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > > >                         }
> > > > > > > > >         } catch (Exception ex) {
> > > > > > > > >                         out.println("<br>");
> > > > > > > > >                         out.println("Exception: " + ex);
> > > > > > > > >                         if(ex instanceof SQLException) {
> > > > > > > > >                                 SQLException
> > sqlex = (SQLException) ex;
> > > > > > > > >                                 out.println("<br>");
> > > > > > > > >                                 out.println("SQL state:
> > > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > > >                                 out.println("<br>");
> > > > > > > > >                                 out.println("Error code:
> > > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > > >                                 out.println("<br><br>");
> > > > > > > > >
> > sqlex.printStackTrace(out);
> > > > > > > > >                                 out.println("<br><br>");
> > > > > > > > >                         }
> > > > > > > > >         }
> > > > > > > > >         finally {
> > > > > > > > >             try { connection.close(); } catch
> > (Exception ex) {}
> > > > > > > > >         }
> > > > > > > > >                 out.println ("</BODY></HTML>");
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >     }
> > > > > > > > > }
> > > > > > > >
> > > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > > > > > <ph...@shareowner.com>
> > > > > > > > wrote:
> > > > > > > > > Detail, detail, detail.
> > > > > > > > >
> > > > > > > > > 1. your context.xml
> > > > > > > > > 2. your web.xml
> > > > > > > > > 3. how do you obtain connection from pool, java
> > code pls. 4. can you
> > > > > > > > > connect using pool 5. commons-pool version
> > > > > > > > >
> > > > > > > > > Etc. etc.
> > > > > > > > >
> > > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > -----Original Message-----
> > > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > > Subject: connection pooling
> > > > > > > > >
> > > > > > > > > Hi all, I have gone over some of the tomcat
> > docs and googled errors
> > > > > > > > > but there is SO much information covering JNDI
> > and Datasources...
> > > > > > > > > and I'm hoping I don't have to be a
> > JNDI/Datasource and XML guru
> > > > > > > > > just to set up db connections via connection pool.
> > > > > > > > >
> > > > > > > > > My situation is this...
> > > > > > > > >
> > > > > > > > > System:
> > > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on
> > an Informix Dynamic
> > > > > > > > > Server 9.4 on Windows Server
> > > > > > > > >
> > > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > > DriverManager.getConnection(). -This leads me
> > to believe that my
> > > > > > > > > jdbc driver is in the correct place ...CATALINA
> > > > > > > > >
> > > > > > > > >
> > --------------------------------------------------------------------
> > > > > > > > > -
> > > > > > > > > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > > > > > >
> > > > > > > > !DSPAM:4165a84c9322136420805!
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > > > > >
> > > > > > >
> > > > > > > !DSPAM:4165bb7715701366110907!
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail:
> > tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail:
> > tomcat-user-help@jakarta.apache.org
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > >
> > > > > :)
> > > > > Atishay Kumar
> > > > > Btech, SEM VII
> > > > > DA-IICT
> > > > > Gandhinagar - 382009
> > > > > India
> > > > > ph: +91 9825383948
> > > > >
> > /*************************************************************
> > ***************
> > > > >  * Learn the rules as you would need them to break them
> > properly *
> > > > >
> > **************************************************************
> > **************/
> > > > >
> > > >
> > >
> > >
> > > --
> > > :)
> > > Atishay Kumar
> > > Btech, SEM VII
> > > DA-IICT
> > > Gandhinagar - 382009
> > > India
> > > ph: +91 9825383948
> > >
> > /*************************************************************
> > ***************
> > >  * Learn the rules as you would need them to break them properly *
> > >
> > **************************************************************
> > **************/
> > >
> > >
> > ---------------------------------------------------------------------
> > >
> > >
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> 
> 
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> 
>

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


RE: connection pooling

Posted by Steve Kirk <to...@web-startup.co.uk>.
Eric - you are correct,  you do not need both <resource-ref> and <Resource>
(although I've found that having both does not cause a problem).

Back to your problem.

The error message indicates that TC cannot find the Resource.

I'm not sure if you are trying to use DBCP or not (in other words, does the
informix driver support pooling on its own, or do you in fact need DBCP or
some other implementation wrapped around it)?  You have
<res-type>javax.sql.DataSource</res-type> but do not list the factory class
under your Resource, e.g. :
<parameter>
	<name>factory</name>
	<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

I have not seen any Java source code on this thread, maybe you posted it
before I started reading it.

Thinking slightly laterally I'll pass on something I learned from Yoav
recently on this list.... you don't need to use container-managed resources
to do connection pooling.  In other words you don't need to set any Resource
or Context to get it to work.

> -----Original Message-----
> From: Eric Wulff [mailto:ewulff@gmail.com] 
> Sent: Friday 05 November 2004 05:57
> To: Tomcat Users List; Atishay Kumar
> Subject: Re: connection pooling
> 
> 
> Thx for your input but, as mentioned in my previous message, I've
> tried this and it does not work.  Also, considering my web.xml I
> shouldn't need this, correct?  I have a <resource-ref> in my web.xml.
> 
> Eric
> 
> 
> On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar
> <at...@gmail.com> wrote:
> > 
> > Pls do the following change after <context......> and u are on!!
> > cheers
> > 
> > 
> > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff 
> <ew...@gmail.com> wrote:
> > > Hi all, I'm returning to a problem I couldn't solve the 
> first time,
> > > about two months ago, and still can't seem to figure out. 
>  I can't get
> > > a db connection using connection pools.  I get the 
> exception listed
> > > below, same as so many have previously, but nothing I've 
> found seems
> > > to works.  Below are my specs.  Anyone with concrete 
> advise/direction
> > > on how to get
> > > this working?
> > >
> > > Also, I noticed in many solutions the suggestion was made 
> to edit the
> > > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> > > However, there is no myapp.xml in that directory on my 
> server. Just 2
> > > .xml's related to other applications and a manager.xml 
> which I'm not
> > > sure what it's related to.
> > >
> > > OS: FC2
> > > Tomcat 5.0.28
> > >
> > > exception: org.apache.commons.dbcp.SWLNestedException: 
> Cannot create
> > > JDBC driver class '' for connect URL 'null'
> > >
> > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> > >         <resource-ref>
> > >                 <res-ref-name>jdbc/wms</res-ref-name>
> > >                 <res-type>javax.sql.DataSource</res-type>
> > >                 <res-auth>Container</res-auth>
> > >         </resource-ref>
> > >
> > > server xml(tried this with and without a Resource name)...
> > > <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> > 
> > <Resource name="jdbc/wms" auth="Container" 
> type="javax.sql.DataSource"/>
> > 
> > 
> > 
> > >     <ResourceParams name="jdbc/wms">
> > >       <parameter>
> > >         <name>username</name>
> > >         <value>whatever</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>password</name>
> > >         <value>whatever</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>driverClassName</name>
> > >         <value>com.informix.jdbc.IfxDriver</value>
> > >       </parameter>
> > >           <parameter>
> > >                 <name>url</name>
> > >         
> <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORM
> IXSERVER=serverName</value>
> > >         </parameter>
> > >     </ResourceParams>
> > >   </Context>
> > >
> > > I have the following jars in my 
> <CATALINA_HONE>/common/lib and I also
> > > tried putting the db driver and commons-collections, 
> dbcp, and pool in
> > > my WEB-INF/lib with no success.  They are all mode 644.
> > >
> > > ant.jar
> > > ant-launcher.jar
> > > commons-collections-3.1.jar
> > > commons-dbcp-1.2.1.jar
> > > commons-el.jar
> > > commons-pool-1.2.jar
> > > ifxjdbc.jar (the necessary informix driver)
> > > jar.txt
> > > jasper-compiler.jar
> > > jasper-runtime.jar
> > > jsp-api.jar
> > > mysql-connector-java-3.0.15-ga-bin.jar
> > > naming-common.jar
> > > naming-factory.jar
> > > naming-java.jar
> > > naming-resources.jar
> > > servlet-api.jar
> > >
> > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > > <at...@gmail.com> wrote:
> > > > hi,
> > > >  i am not sure but you may try downloading latest jar files for
> > > > following froom tomcat site and try them out. copy the 
> old jar files
> > > > somewhere else and try using the latest jar files.
> > > > 1) Commons Collections
> > > > 2)Commons DBCP
> > > > 3)Commons Pool
> > > >
> > > >
> > > >
> > > >
> > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff 
> <ew...@gmail.com> wrote:
> > > > > Except that the driver works for connecting if I'm 
> not utilizing a
> > > > > connection pool, i.e., I am able to connect to the db 
> and manipulate
> > > > > data via DriverManager.getConnection(url, db, pwd).
> > > > >
> > > > > The driver is located in CATALINA_HOME/commons/lib
> > > > >
> > > > > Eric
> > > > >
> > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > > <ph...@shareowner.com> wrote:
> > > > > > No, you don't need that many params. I think your 
> problem might be the
> > > > >
> > > > >
> > > > > > driver. Where did you drop off your informix jdbc jar?
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > Sent: October 7, 2004 5:56 PM
> > > > > > To: Tomcat Users List
> > > > > > Subject: Re: connection pooling
> > > > > >
> > > > > > Yes, I have added <Resource name=... >.  Now 
> different errors are reported
> > > > > > via stack trace as I posted in response to 
> Atishay's suggestion that I add
> > > > > > this.  I'll try adding your suggestions and see 
> what happens.  Also, you
> > > > > > suggest adding many parameters.  Are they necessary 
> for simply making a
> > > > > > connection?  If so, the tutorial I'm following, 
> 'Tomcat Kick Start' left all
> > > > > > your suggestions out.
> > > > > > Including the <Resource> tag, but that seems 
> critical for connection.
> > > > > >
> > > > > > Eric
> > > > > >
> > > > > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin 
> <ph...@shareowner.com>
> > > > > > wrote:
> > > > > > > 1. web.xml: OK
> > > > > > >
> > > > > > > 2. context.xml on <context> of server.xml:
> > > > > > >
> > > > > > >         <Resource name="jdbc/test_connect" 
> auth="Container"
> > > > > > > type="javax.sql.DataSource"/> <= have you added this?
> > > > > > >         <ResourceParams name="jdbc/test_connect">
> > > > > > >         <parameter>
> > > > > > >                 <name>driverClassName</name>
> > > > > > >                 <value>your.jdbc.driver</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>url</name>
> > > > > > >                 <value>your.jdbc.url</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>username</name>
> > > > > > >                 <value>youruser</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>password</name>
> > > > > > >                 <value>yourpass</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>maxActive</name>
> > > > > > >                 <value>20</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>maxIdle</name>
> > > > > > >                 <value>10</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>minIdle</name>
> > > > > > >                 <value>10</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>maxWait</name>
> > > > > > >                 <value>15000</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>removeAbandoned</name>
> > > > > > >                 <value>true</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>validationQuery</name>
> > > > > > >                 <value>your_query</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>testOnBorrow</name>
> > > > > > >                 <value>true</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>testOnReturn</name>
> > > > > > >                 <value>true</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>minEvictableIdleTimeMillis</name>
> > > > > > >                 <value>-1</value>
> > > > > > >         </parameter>
> > > > > > >         <!-- sleeps 5 minutes -->
> > > > > > >         <parameter>
> > > > > > >                 <name>timeBetweenEvictionRunsMillis</name>
> > > > > > >                 <value>300000</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>numTestsPerEvictionRun</name>
> > > > > > >                 <value>1</value>
> > > > > > >         </parameter>
> > > > > > >         <parameter>
> > > > > > >                 <name>testWhileIdle</name>
> > > > > > >                 <value>true</value>
> > > > > > >         </parameter>
> > > > > > >
> > > > > > >         </ResourceParams>
> > > > > > >
> > > > > > > 3. code
> > > > > > >
> > > > > > >                 Context initContext = new 
> InitialContext();
> > > > > > >                 Context jdbcContext = (Context)
> > > > > > > initContext.lookup("java:comp/env");
> > > > > > >                 DataSource dataSource = (DataSource)
> > > > > > > jdbcContext.lookup("jdbc/test_connect");
> > > > > > >                 ...
> > > > > > >
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > Sent: October 7, 2004 4:34 PM
> > > > > > > To: Tomcat Users List
> > > > > > > Subject: Re: connection pooling
> > > > > > >
> > > > > > > Hi Phillip,
> > > > > > >
> > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > > > > Detail, detail, detail.
> > > > > > > >
> > > > > > > > 1. your context.xml
> > > > > > > > 2. your web.xml
> > > > > > > > 3. how do you obtain connection from pool, java 
> code pls. 4. can you
> > > > > > > > connect using pool 5. commons-pool version
> > > > > > > >
> > > > > > > > Etc. etc.
> > > > > > > >
> > > > > > > > You need to provide details otherwise we can't help.
> > > > > > >
> > > > > > > This was all included in my original post.  Ok, 
> actually my 2nd post
> > > > > > > because I accidentally hit send prior to 
> completing my post via the
> > > > > > > scroll pad on my laptop.  Still, thx for checking 
> on this and the info
> > > > > > > you looking for is copied again here...
> > > > > > >
> > > > > > > System:
> > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on 
> an Informix Dynamic
> > > > > > > Server 9.4 on Windows Server
> > > > > > >
> > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > DriverManager.getConnection().  This leads me to 
> believe that my
> > > > > > > informix jdbc driver is in the correct place...
> > > > > > > CATALINA_HOME/common/lib -I have a Context set up 
> in my server.xml per
> > > > > > > examples in a text tutorial I'm referencing
> > > > > > >
> > > > > > > Below listed...
> > > > > > > -errors
> > > > > > > -web.xml
> > > > > > > -server.xml <Context> (minus connection actual values)
> > > > > > > -.java
> > > > > > >
> > > > > > > exception/errors:
> > > > > > > -Exception: 
> org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > > > > JDBC driver of class '' for connect URL 'null' 
> SQL state: null Error
> > > > > > > code: 0
> > > > > > >
> > > > > > > -stack trace reveals this, but I can't see why 
> since I have the driver
> > > > > > > in the correct directory...
> > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > 
> java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > > > > ce.jav
> > > > > > > a:773)
> > > > > > >
> > > > > > > web.xml:
> > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > <!DOCTYPE web-app
> > > > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web 
> Application 2.3//EN"
> > > > > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > <web-app>
> > > > > > >        <servlet>
> > > > > > >                <servlet-name>Test Connection 
> Pooling</servlet-name>
> > > > > > >                
> <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > >        </servlet>
> > > > > > >
> > > > > > >        <servlet-mapping>
> > > > > > >                <servlet-name>Test Connection 
> Pooling</servlet-name>
> > > > > > >                
> <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > >        </servlet-mapping>
> > > > > > >
> > > > > > >        <resource-ref>
> > > > > > >          <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > >          <res-type>javax.sql.DataSource</res-type>
> > > > > > >          <res-auth>Container</res-auth>
> > > > > > >        </resource-ref>
> > > > > > > </web-app>
> > > > > > >
> > > > > > > server.xml <Context>:
> > > > > > >  <Context path="/testConnectionPooling"
> > > > > > > docBase="testConnectionPooling" debug="0" 
> reloadable="true">
> > > > > > >    <ResourceParams name="jdbc/test_connect">
> > > > > > >      <parameter>
> > > > > > >        <name>username</name>
> > > > > > >        <value>informix</value>
> > > > > > >      </parameter>
> > > > > > >      <parameter>
> > > > > > >        <name>password</name>
> > > > > > >        <value>informix</value>
> > > > > > >      </parameter>
> > > > > > >      <parameter>
> > > > > > >        <name>driverClassName</name>
> > > > > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > > > > >      </parameter>
> > > > > > >      <parameter>
> > > > > > >        <name>url</name>
> > > > > > > 
> <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > /value
> > > > > > > >
> > > > > > >      </parameter>
> > > > > > >    </ResourceParams>
> > > > > > >  </Context>
> > > > > > >
> > > > > > > .java:
> > > > > > > import java.io.*;
> > > > > > > import java.sql.*;
> > > > > > > // -Must import javax.naming use JNDI which is 
> required to implement data
> > > > > > > //   resource references and hence connection pooling.
> > > > > > > import javax.naming.*;
> > > > > > > import javax.sql.*;
> > > > > > > import javax.servlet.*;
> > > > > > > import javax.servlet.http.*;
> > > > > > > import java.util.*;
> > > > > > >
> > > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > > >        private DataSource dataSource;
> > > > > > >
> > > > > > >        public void init(ServletConfig config) 
> throws ServletException {
> > > > > > >                try {
> > > > > > >                        Context init = new 
> InitialContext();
> > > > > > >                        // don't know what the 
> 'java:comp/env' refers to
> > > > > > >                        Context ctx = (Context)
> > > > > > init.lookup("java:comp/env");
> > > > > > >                        // I know "jdbc/conversion 
> must match the
> > > > > > > web.xml res-ref-name of the web.xml but don't 
> know what the path really
> > > > > > refers to
> > > > > > >                        dataSource = (DataSource)
> > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > >                } catch (NamingException ex) {
> > > > > > >                        throw new 
> ServletException("Cannot retrieve
> > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > >                }
> > > > > > >        }
> > > > > > >
> > > > > > >        public void doGet(HttpServletRequest request,
> > > > > > > HttpServletResponse
> > > > > > > response)
> > > > > > >        throws ServletException, IOException {
> > > > > > >                response.setContentType("text/html");
> > > > > > >                PrintWriter out = response.getWriter();
> > > > > > >                Connection connection = null;
> > > > > > >                out.println 
> ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > >                out.println("<H1>Customer Name 
> Query</H1>");
> > > > > > >
> > > > > > >                try {
> > > > > > >                        synchronized(dataSource) {
> > > > > > >                            connection = 
> dataSource.getConnection();
> > > > > > >                        }
> > > > > > >                        out.println("<br>");
> > > > > > >                        
> out.println("<strong>Loaded informix driver
> > > > > > > successfully via server.xml.</strong>" +
> > > > > > >                                                
> "Now attempting db
> > > > > > > connection.");
> > > > > > >                        out.println("<br>");
> > > > > > >                        PreparedStatement pstmt =
> > > > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > > > >                        ResultSet results = 
> pstmt.executeQuery();
> > > > > > >                        if (!results.next()) {
> > > > > > >                                throw new 
> SQLException("No data
> > > > > > > returned for some reason");
> > > > > > >                        }
> > > > > > >                        out.println("<br>");
> > > > > > >                        while(results.next()) {
> > > > > > >                                out.println("<tr><td>" +
> > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > >                        }
> > > > > > >        } catch (Exception ex) {
> > > > > > >                        out.println("<br>");
> > > > > > >                        out.println("Exception: " + ex);
> > > > > > >                        if(ex instanceof SQLException) {
> > > > > > >                                SQLException sqlex 
> = (SQLException) ex;
> > > > > > >                                out.println("<br>");
> > > > > > >                                out.println("SQL state:
> > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > >                                out.println("<br>");
> > > > > > >                                out.println("Error code:
> > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > >                                out.println("<br><br>");
> > > > > > >                                sqlex.printStackTrace(out);
> > > > > > >                                out.println("<br><br>");
> > > > > > >                        }
> > > > > > >        }
> > > > > > >        finally {
> > > > > > >            try { connection.close(); } catch 
> (Exception ex) {}
> > > > > > >        }
> > > > > > >                out.println ("</BODY></HTML>");
> > > > > > >    }
> > > > > > > }
> > > > > > >
> > > > > > >   ReplyForward
> > > > > > >
> > > > > > > jthompson@honda.co.nz
> > > > > > > java code: Context ctx = (Context) 
> init.lookup("xxxxxx"); server.xml:
> > > > > > > <Resour...
> > > > > > >                  Oct 6 (22 hours ago)
> > > > > > >
> > > > > > > jthompson@honda.co.nz
> > > > > > > Please ignore my last post - it's wrong. 
> (Answered before verifying).
> > > > > > >                  Oct 6 (22 hours ago)
> > > > > > >
> > > > > > > jthompson@honda.co.nz
> > > > > > > Is that litterally what you have in your server.xml?
> > > > > > >                  Oct 6 (22 hours ago)
> > > > > > >
> > > > > > > Eric Wulff
> > > > > > > No, literally I have the actual values. The same 
> connection string I
> > > > > > > use to s...
> > > > > > >                  Oct 6 (22 hours ago)
> > > > > > >
> > > > > > > jthompson@honda.co.nz
> > > > > > > Is there a xxxxx.xml file in 
> (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > > > > where xxx...
> > > > > > >                  Oct 6 (22 hours ago)
> > > > > > >
> > > > > > > Eric Wulff
> > > > > > > Context name? I assume your referring to the 
> ResourceParams name
> > > > > > > attribute, j...
> > > > > > >                  Oct 6 (19 hours ago)
> > > > > > >
> > > > > > > Phillip Qin
> > > > > > > <ph...@shareowner.com> to Tomcat
> > > > > > >          More options    6:29am (7 hours ago)
> > > > > > > Detail, detail, detail.
> > > > > > >
> > > > > > > 1. your context.xml
> > > > > > > 2. your web.xml
> > > > > > > 3. how do you obtain connection from pool, java code pls.
> > > > > > > 4. can you connect using pool
> > > > > > > 5. commons-pool version
> > > > > > >
> > > > > > > Etc. etc.
> > > > > > >
> > > > > > > You need to provide details otherwise we can't help.
> > > > > > > - Show quoted text -
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > Subject: connection pooling
> > > > > > >
> > > > > > > Hi all, I have gone over some of the tomcat docs 
> and googled errors
> > > > > > > but there is SO much information covering JNDI 
> and Datasources... and
> > > > > > > I'm hoping I don't have to be a JNDI/Datasource 
> and XML guru just to
> > > > > > > set up db connections via connection pool.
> > > > > > >
> > > > > > > My situation is this...
> > > > > > >
> > > > > > > System:
> > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on 
> an Informix Dynamic
> > > > > > > Server 9.4 on Windows Server
> > > > > > >
> > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > DriverManager.getConnection(). -This leads me to 
> believe that my jdbc
> > > > > > > driver is in the correct place ...CATALINA
> > > > > > >
> > > > > > > 
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > > > > >
> > > > > > >
> > > > > > >   ReplyForwardInvite Phillip to Gmail
> > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > > To:
> > > > > > > Cc:
> > > > > > > Bcc:
> > > > > > >
> > > > > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > > > > Subject:
> > > > > > >
> > > > > > > Attach a file
> > > > > > >
> > > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > >
> > > > > > > Atishay Kumar
> > > > > > > <at...@gmail.com> to Tomcat, me
> > > > > > >          More options    6:47am (6 hours ago)
> > > > > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff 
> <ew...@gmail.com>
> > > > > > > wrote:
> > > > > > > > I have gone over some of the tomcat docs and 
> googled errors but
> > > > > > > > there is SO much information covering JNDI, 
> connection pooling, and
> > > > > > > > Datasources.  Can someone review the info below 
> and consult or point
> > > > > > > > me in the right direction?  Although I feel I'm 
> missing something
> > > > > > > > obvious, I can't find out what's wrong with my set-up.
> > > > > > > >
> > > > > > > > thx
> > > > > > > > Eric
> > > > > > > >
> > > > > > > > System:
> > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on 
> an Informix Dynamic
> > > > > > > > Server 9.4 on Windows Server
> > > > > > > >
> > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > DriverManager.getConnection().  This leads me 
> to believe that my
> > > > > > > > informix jdbc driver is in the correct place...
> > > > > > > > CATALINA_HOME/common/lib -I have a Context set 
> up in my server.xml
> > > > > > > > per examples in a text tutorial I'm referencing
> > > > > > > >
> > > > > > > > Below listed...
> > > > > > > > -errors
> > > > > > > > -web.xml
> > > > > > > > -server.xml <Context> (minus connection actual 
> values) -.java
> > > > > > > >
> > > > > > > > exception/errors:
> > > > > > > > -Exception: 
> org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > > > > create JDBC driver of class '' for connect URL 
> 'null' SQL state:
> > > > > > > > null Error code: 0
> > > > > > > >
> > > > > > > > -stack trace reveals this, but I can't see why 
> since I have the
> > > > > > > > driver in the correct directory...
> > > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > > 
> java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > > 
> org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > > > > ur
> > > > > > > > ce.java:773)
> > > > > > > >
> > > > > > > > web.xml:
> > > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > > <!DOCTYPE web-app
> > > > > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web 
> Application 2.3//EN"
> > > > > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > > <web-app>
> > > > > > > >         <servlet>
> > > > > > > >                 <servlet-name>Test Connection 
> Pooling</servlet-name>
> > > > > > > >                 
> <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > > >         </servlet>
> > > > > > > >
> > > > > > > >         <servlet-mapping>
> > > > > > > >                 <servlet-name>Test Connection 
> Pooling</servlet-name>
> > > > > > > >                 
> <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > > >         </servlet-mapping>
> > > > > > > >
> > > > > > > >         <resource-ref>
> > > > > > > >           <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > > > > >           <res-auth>Container</res-auth>
> > > > > > > >         </resource-ref>
> > > > > > > > </web-app>
> > > > > > > >
> > > > > > > > server.xml <Context>:
> > > > > > > >   <Context path="/testConnectionPooling"
> > > > > > > > docBase="testConnectionPooling" debug="0" 
> reloadable="true">
> > > > > > >
> > > > > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > > > > type="javax.sql.DataSource"/> is missing
> > > > > > >
> > > > > > > >     <ResourceParams name="jdbc/test_connect">
> > > > > > > >       <parameter>
> > > > > > > >         <name>username</name>
> > > > > > > >         <value>informix</value>
> > > > > > > >       </parameter>
> > > > > > > >       <parameter>
> > > > > > > >         <name>password</name>
> > > > > > > >         <value>informix</value>
> > > > > > > >       </parameter>
> > > > > > > >       <parameter>
> > > > > > > >         <name>driverClassName</name>
> > > > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > > > >       </parameter>
> > > > > > > >       <parameter>
> > > > > > > >         <name>url</name>
> > > > > > > >
> > > > > > > 
> <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > > /value
> > > > > > > >
> > > > > > > >       </parameter>
> > > > > > > >     </ResourceParams>
> > > > > > > >   </Context>
> > > > > > > >
> > > > > > > > .java:
> > > > > > > > import java.io.*;
> > > > > > > > import java.sql.*;
> > > > > > > > // -Must import javax.naming use JNDI which is 
> required to implement
> > > > > > data
> > > > > > > > //   resource references and hence connection pooling.
> > > > > > > > import javax.naming.*;
> > > > > > > > import javax.sql.*;
> > > > > > > > import javax.servlet.*;
> > > > > > > > import javax.servlet.http.*;
> > > > > > > > import java.util.*;
> > > > > > > >
> > > > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > > > >         private DataSource dataSource;
> > > > > > > >
> > > > > > > >         public void init(ServletConfig config) 
> throws ServletException {
> > > > > > > >                 try {
> > > > > > > >                         Context init = new 
> InitialContext();
> > > > > > > >                         // don't know what the 
> 'java:comp/env' refers to
> > > > > > > >                         Context ctx = (Context)
> > > > > > > init.lookup("java:comp/env");
> > > > > > > >                         // I know 
> "jdbc/conversion must match the
> > > > > > > > web.xml res-ref-name of the web.xml but don't 
> know what the path
> > > > > > > > really
> > > > > > > refers to
> > > > > > > >                         dataSource = (DataSource)
> > > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > > >                 } catch (NamingException ex) {
> > > > > > > >                         throw new 
> ServletException("Cannot retrieve
> > > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > > >                 }
> > > > > > > >         }
> > > > > > > >
> > > > > > > >         public void doGet(HttpServletRequest request,
> > > > > > > > HttpServletResponse
> > > > > > > response)
> > > > > > > >         throws ServletException, IOException {
> > > > > > > >                 response.setContentType("text/html");
> > > > > > > >                 PrintWriter out = response.getWriter();
> > > > > > > >                 Connection connection = null;
> > > > > > > >                 out.println 
> ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > > >                 out.println("<H1>Customer Name 
> Query</H1>");
> > > > > > > >
> > > > > > > >                 try {
> > > > > > > >                         synchronized(dataSource) {
> > > > > > > >                             connection = 
> dataSource.getConnection();
> > > > > > > >                         }
> > > > > > > >                         out.println("<br>");
> > > > > > > >                         
> out.println("<strong>Loaded informix driver
> > > > > > > > successfully via server.xml.</strong>" +
> > > > > > > >                                                 
> "Now attempting db
> > > > > > > connection.");
> > > > > > > >                         out.println("<br>");
> > > > > > > >                         PreparedStatement pstmt =
> > > > > > > > connection.prepareStatement("SELECT blah FROM 
> blah blah");
> > > > > > > >                         ResultSet results = 
> pstmt.executeQuery();
> > > > > > > >                         if (!results.next()) {
> > > > > > > >                                 throw new 
> SQLException("No data
> > > > > > > > returned
> > > > > > > for some reason");
> > > > > > > >                         }
> > > > > > > >                         out.println("<br>");
> > > > > > > >                         while(results.next()) {
> > > > > > > >                                 out.println("<tr><td>" +
> > > > > > > results.getString("blah") + "</td></tr>");
> > > > > > > >                         }
> > > > > > > >         } catch (Exception ex) {
> > > > > > > >                         out.println("<br>");
> > > > > > > >                         out.println("Exception: " + ex);
> > > > > > > >                         if(ex instanceof SQLException) {
> > > > > > > >                                 SQLException 
> sqlex = (SQLException) ex;
> > > > > > > >                                 out.println("<br>");
> > > > > > > >                                 out.println("SQL state:
> > > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > > >                                 out.println("<br>");
> > > > > > > >                                 out.println("Error code:
> > > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > > >                                 out.println("<br><br>");
> > > > > > > >                                 
> sqlex.printStackTrace(out);
> > > > > > > >                                 out.println("<br><br>");
> > > > > > > >                         }
> > > > > > > >         }
> > > > > > > >         finally {
> > > > > > > >             try { connection.close(); } catch 
> (Exception ex) {}
> > > > > > > >         }
> > > > > > > >                 out.println ("</BODY></HTML>");
> > > > > > > >
> > > > > > > >
> > > > > > > >     }
> > > > > > > > }
> > > > > > >
> > > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > > > > <ph...@shareowner.com>
> > > > > > > wrote:
> > > > > > > > Detail, detail, detail.
> > > > > > > >
> > > > > > > > 1. your context.xml
> > > > > > > > 2. your web.xml
> > > > > > > > 3. how do you obtain connection from pool, java 
> code pls. 4. can you
> > > > > > > > connect using pool 5. commons-pool version
> > > > > > > >
> > > > > > > > Etc. etc.
> > > > > > > >
> > > > > > > > You need to provide details otherwise we can't help.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > -----Original Message-----
> > > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > > Subject: connection pooling
> > > > > > > >
> > > > > > > > Hi all, I have gone over some of the tomcat 
> docs and googled errors
> > > > > > > > but there is SO much information covering JNDI 
> and Datasources...
> > > > > > > > and I'm hoping I don't have to be a 
> JNDI/Datasource and XML guru
> > > > > > > > just to set up db connections via connection pool.
> > > > > > > >
> > > > > > > > My situation is this...
> > > > > > > >
> > > > > > > > System:
> > > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on 
> an Informix Dynamic
> > > > > > > > Server 9.4 on Windows Server
> > > > > > > >
> > > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > > DriverManager.getConnection(). -This leads me 
> to believe that my
> > > > > > > > jdbc driver is in the correct place ...CATALINA
> > > > > > > >
> > > > > > > > 
> --------------------------------------------------------------------
> > > > > > > > -
> > > > > > > > To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > > 
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > > > > >
> > > > > > > !DSPAM:4165a84c9322136420805!
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > 
> ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > > > >
> > > > > >
> > > > > > !DSPAM:4165bb7715701366110907!
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > 
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: 
> tomcat-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: 
> tomcat-user-help@jakarta.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > >
> > > > :)
> > > > Atishay Kumar
> > > > Btech, SEM VII
> > > > DA-IICT
> > > > Gandhinagar - 382009
> > > > India
> > > > ph: +91 9825383948
> > > > 
> /*************************************************************
> ***************
> > > >  * Learn the rules as you would need them to break them 
> properly *
> > > >  
> **************************************************************
> **************/
> > > >
> > >
> > 
> > 
> > --
> > :)
> > Atishay Kumar
> > Btech, SEM VII
> > DA-IICT
> > Gandhinagar - 382009
> > India
> > ph: +91 9825383948
> > 
> /*************************************************************
> ***************
> >  * Learn the rules as you would need them to break them properly *
> >  
> **************************************************************
> **************/
> > 
> > 
> ---------------------------------------------------------------------
> > 
> > 
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



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


Re: connection pooling

Posted by Eric Wulff <ew...@gmail.com>.
Thx for your input but, as mentioned in my previous message, I've
tried this and it does not work.  Also, considering my web.xml I
shouldn't need this, correct?  I have a <resource-ref> in my web.xml.

Eric


On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar
<at...@gmail.com> wrote:
> 
> Pls do the following change after <context......> and u are on!!
> cheers
> 
> 
> On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> > Hi all, I'm returning to a problem I couldn't solve the first time,
> > about two months ago, and still can't seem to figure out.  I can't get
> > a db connection using connection pools.  I get the exception listed
> > below, same as so many have previously, but nothing I've found seems
> > to works.  Below are my specs.  Anyone with concrete advise/direction
> > on how to get
> > this working?
> >
> > Also, I noticed in many solutions the suggestion was made to edit the
> > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> > However, there is no myapp.xml in that directory on my server. Just 2
> > .xml's related to other applications and a manager.xml which I'm not
> > sure what it's related to.
> >
> > OS: FC2
> > Tomcat 5.0.28
> >
> > exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> > JDBC driver class '' for connect URL 'null'
> >
> > WEB-INF web xml: code inserted AFTER all servlet mappings...
> >         <resource-ref>
> >                 <res-ref-name>jdbc/wms</res-ref-name>
> >                 <res-type>javax.sql.DataSource</res-type>
> >                 <res-auth>Container</res-auth>
> >         </resource-ref>
> >
> > server xml(tried this with and without a Resource name)...
> > <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> 
> <Resource name="jdbc/wms" auth="Container" type="javax.sql.DataSource"/>
> 
> 
> 
> >     <ResourceParams name="jdbc/wms">
> >       <parameter>
> >         <name>username</name>
> >         <value>whatever</value>
> >       </parameter>
> >       <parameter>
> >         <name>password</name>
> >         <value>whatever</value>
> >       </parameter>
> >       <parameter>
> >         <name>driverClassName</name>
> >         <value>com.informix.jdbc.IfxDriver</value>
> >       </parameter>
> >           <parameter>
> >                 <name>url</name>
> >         <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
> >         </parameter>
> >     </ResourceParams>
> >   </Context>
> >
> > I have the following jars in my <CATALINA_HONE>/common/lib and I also
> > tried putting the db driver and commons-collections, dbcp, and pool in
> > my WEB-INF/lib with no success.  They are all mode 644.
> >
> > ant.jar
> > ant-launcher.jar
> > commons-collections-3.1.jar
> > commons-dbcp-1.2.1.jar
> > commons-el.jar
> > commons-pool-1.2.jar
> > ifxjdbc.jar (the necessary informix driver)
> > jar.txt
> > jasper-compiler.jar
> > jasper-runtime.jar
> > jsp-api.jar
> > mysql-connector-java-3.0.15-ga-bin.jar
> > naming-common.jar
> > naming-factory.jar
> > naming-java.jar
> > naming-resources.jar
> > servlet-api.jar
> >
> > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > <at...@gmail.com> wrote:
> > > hi,
> > >  i am not sure but you may try downloading latest jar files for
> > > following froom tomcat site and try them out. copy the old jar files
> > > somewhere else and try using the latest jar files.
> > > 1) Commons Collections
> > > 2)Commons DBCP
> > > 3)Commons Pool
> > >
> > >
> > >
> > >
> > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > > > Except that the driver works for connecting if I'm not utilizing a
> > > > connection pool, i.e., I am able to connect to the db and manipulate
> > > > data via DriverManager.getConnection(url, db, pwd).
> > > >
> > > > The driver is located in CATALINA_HOME/commons/lib
> > > >
> > > > Eric
> > > >
> > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > <ph...@shareowner.com> wrote:
> > > > > No, you don't need that many params. I think your problem might be the
> > > >
> > > >
> > > > > driver. Where did you drop off your informix jdbc jar?
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > Sent: October 7, 2004 5:56 PM
> > > > > To: Tomcat Users List
> > > > > Subject: Re: connection pooling
> > > > >
> > > > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > > > suggest adding many parameters.  Are they necessary for simply making a
> > > > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
> > > > > your suggestions out.
> > > > > Including the <Resource> tag, but that seems critical for connection.
> > > > >
> > > > > Eric
> > > > >
> > > > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin <ph...@shareowner.com>
> > > > > wrote:
> > > > > > 1. web.xml: OK
> > > > > >
> > > > > > 2. context.xml on <context> of server.xml:
> > > > > >
> > > > > >         <Resource name="jdbc/test_connect" auth="Container"
> > > > > > type="javax.sql.DataSource"/> <= have you added this?
> > > > > >         <ResourceParams name="jdbc/test_connect">
> > > > > >         <parameter>
> > > > > >                 <name>driverClassName</name>
> > > > > >                 <value>your.jdbc.driver</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>url</name>
> > > > > >                 <value>your.jdbc.url</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>username</name>
> > > > > >                 <value>youruser</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>password</name>
> > > > > >                 <value>yourpass</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>maxActive</name>
> > > > > >                 <value>20</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>maxIdle</name>
> > > > > >                 <value>10</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>minIdle</name>
> > > > > >                 <value>10</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>maxWait</name>
> > > > > >                 <value>15000</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>removeAbandoned</name>
> > > > > >                 <value>true</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>validationQuery</name>
> > > > > >                 <value>your_query</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>testOnBorrow</name>
> > > > > >                 <value>true</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>testOnReturn</name>
> > > > > >                 <value>true</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>minEvictableIdleTimeMillis</name>
> > > > > >                 <value>-1</value>
> > > > > >         </parameter>
> > > > > >         <!-- sleeps 5 minutes -->
> > > > > >         <parameter>
> > > > > >                 <name>timeBetweenEvictionRunsMillis</name>
> > > > > >                 <value>300000</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>numTestsPerEvictionRun</name>
> > > > > >                 <value>1</value>
> > > > > >         </parameter>
> > > > > >         <parameter>
> > > > > >                 <name>testWhileIdle</name>
> > > > > >                 <value>true</value>
> > > > > >         </parameter>
> > > > > >
> > > > > >         </ResourceParams>
> > > > > >
> > > > > > 3. code
> > > > > >
> > > > > >                 Context initContext = new InitialContext();
> > > > > >                 Context jdbcContext = (Context)
> > > > > > initContext.lookup("java:comp/env");
> > > > > >                 DataSource dataSource = (DataSource)
> > > > > > jdbcContext.lookup("jdbc/test_connect");
> > > > > >                 ...
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > Sent: October 7, 2004 4:34 PM
> > > > > > To: Tomcat Users List
> > > > > > Subject: Re: connection pooling
> > > > > >
> > > > > > Hi Phillip,
> > > > > >
> > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > > > Detail, detail, detail.
> > > > > > >
> > > > > > > 1. your context.xml
> > > > > > > 2. your web.xml
> > > > > > > 3. how do you obtain connection from pool, java code pls. 4. can you
> > > > > > > connect using pool 5. commons-pool version
> > > > > > >
> > > > > > > Etc. etc.
> > > > > > >
> > > > > > > You need to provide details otherwise we can't help.
> > > > > >
> > > > > > This was all included in my original post.  Ok, actually my 2nd post
> > > > > > because I accidentally hit send prior to completing my post via the
> > > > > > scroll pad on my laptop.  Still, thx for checking on this and the info
> > > > > > you looking for is copied again here...
> > > > > >
> > > > > > System:
> > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > > Server 9.4 on Windows Server
> > > > > >
> > > > > > -I am able to connect to my db via typical JDBC
> > > > > > DriverManager.getConnection().  This leads me to believe that my
> > > > > > informix jdbc driver is in the correct place...
> > > > > > CATALINA_HOME/common/lib -I have a Context set up in my server.xml per
> > > > > > examples in a text tutorial I'm referencing
> > > > > >
> > > > > > Below listed...
> > > > > > -errors
> > > > > > -web.xml
> > > > > > -server.xml <Context> (minus connection actual values)
> > > > > > -.java
> > > > > >
> > > > > > exception/errors:
> > > > > > -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > > > JDBC driver of class '' for connect URL 'null' SQL state: null Error
> > > > > > code: 0
> > > > > >
> > > > > > -stack trace reveals this, but I can't see why since I have the driver
> > > > > > in the correct directory...
> > > > > > java.sql.SQLException: No suitable driver at
> > > > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > > > ce.jav
> > > > > > a:773)
> > > > > >
> > > > > > web.xml:
> > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > <!DOCTYPE web-app
> > > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > <web-app>
> > > > > >        <servlet>
> > > > > >                <servlet-name>Test Connection Pooling</servlet-name>
> > > > > >                <servlet-class>TestConnectionPooling</servlet-class>
> > > > > >        </servlet>
> > > > > >
> > > > > >        <servlet-mapping>
> > > > > >                <servlet-name>Test Connection Pooling</servlet-name>
> > > > > >                <url-pattern>/testConnectionPooling</url-pattern>
> > > > > >        </servlet-mapping>
> > > > > >
> > > > > >        <resource-ref>
> > > > > >          <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > >          <res-type>javax.sql.DataSource</res-type>
> > > > > >          <res-auth>Container</res-auth>
> > > > > >        </resource-ref>
> > > > > > </web-app>
> > > > > >
> > > > > > server.xml <Context>:
> > > > > >  <Context path="/testConnectionPooling"
> > > > > > docBase="testConnectionPooling" debug="0" reloadable="true">
> > > > > >    <ResourceParams name="jdbc/test_connect">
> > > > > >      <parameter>
> > > > > >        <name>username</name>
> > > > > >        <value>informix</value>
> > > > > >      </parameter>
> > > > > >      <parameter>
> > > > > >        <name>password</name>
> > > > > >        <value>informix</value>
> > > > > >      </parameter>
> > > > > >      <parameter>
> > > > > >        <name>driverClassName</name>
> > > > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > > > >      </parameter>
> > > > > >      <parameter>
> > > > > >        <name>url</name>
> > > > > > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > /value
> > > > > > >
> > > > > >      </parameter>
> > > > > >    </ResourceParams>
> > > > > >  </Context>
> > > > > >
> > > > > > .java:
> > > > > > import java.io.*;
> > > > > > import java.sql.*;
> > > > > > // -Must import javax.naming use JNDI which is required to implement data
> > > > > > //   resource references and hence connection pooling.
> > > > > > import javax.naming.*;
> > > > > > import javax.sql.*;
> > > > > > import javax.servlet.*;
> > > > > > import javax.servlet.http.*;
> > > > > > import java.util.*;
> > > > > >
> > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > >        private DataSource dataSource;
> > > > > >
> > > > > >        public void init(ServletConfig config) throws ServletException {
> > > > > >                try {
> > > > > >                        Context init = new InitialContext();
> > > > > >                        // don't know what the 'java:comp/env' refers to
> > > > > >                        Context ctx = (Context)
> > > > > init.lookup("java:comp/env");
> > > > > >                        // I know "jdbc/conversion must match the
> > > > > > web.xml res-ref-name of the web.xml but don't know what the path really
> > > > > refers to
> > > > > >                        dataSource = (DataSource)
> > > > > > ctx.lookup("jdbc/test_connect");
> > > > > >                } catch (NamingException ex) {
> > > > > >                        throw new ServletException("Cannot retrieve
> > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > >                }
> > > > > >        }
> > > > > >
> > > > > >        public void doGet(HttpServletRequest request,
> > > > > > HttpServletResponse
> > > > > > response)
> > > > > >        throws ServletException, IOException {
> > > > > >                response.setContentType("text/html");
> > > > > >                PrintWriter out = response.getWriter();
> > > > > >                Connection connection = null;
> > > > > >                out.println ("<HTML><HEAD><TITLE>Test Connection
> > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > >                out.println("<H1>Customer Name Query</H1>");
> > > > > >
> > > > > >                try {
> > > > > >                        synchronized(dataSource) {
> > > > > >                            connection = dataSource.getConnection();
> > > > > >                        }
> > > > > >                        out.println("<br>");
> > > > > >                        out.println("<strong>Loaded informix driver
> > > > > > successfully via server.xml.</strong>" +
> > > > > >                                                "Now attempting db
> > > > > > connection.");
> > > > > >                        out.println("<br>");
> > > > > >                        PreparedStatement pstmt =
> > > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > > >                        ResultSet results = pstmt.executeQuery();
> > > > > >                        if (!results.next()) {
> > > > > >                                throw new SQLException("No data
> > > > > > returned for some reason");
> > > > > >                        }
> > > > > >                        out.println("<br>");
> > > > > >                        while(results.next()) {
> > > > > >                                out.println("<tr><td>" +
> > > > > > results.getString("blah") + "</td></tr>");
> > > > > >                        }
> > > > > >        } catch (Exception ex) {
> > > > > >                        out.println("<br>");
> > > > > >                        out.println("Exception: " + ex);
> > > > > >                        if(ex instanceof SQLException) {
> > > > > >                                SQLException sqlex = (SQLException) ex;
> > > > > >                                out.println("<br>");
> > > > > >                                out.println("SQL state:
> > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > >                                out.println("<br>");
> > > > > >                                out.println("Error code:
> > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > >                                out.println("<br><br>");
> > > > > >                                sqlex.printStackTrace(out);
> > > > > >                                out.println("<br><br>");
> > > > > >                        }
> > > > > >        }
> > > > > >        finally {
> > > > > >            try { connection.close(); } catch (Exception ex) {}
> > > > > >        }
> > > > > >                out.println ("</BODY></HTML>");
> > > > > >    }
> > > > > > }
> > > > > >
> > > > > >   ReplyForward
> > > > > >
> > > > > > jthompson@honda.co.nz
> > > > > > java code: Context ctx = (Context) init.lookup("xxxxxx"); server.xml:
> > > > > > <Resour...
> > > > > >                  Oct 6 (22 hours ago)
> > > > > >
> > > > > > jthompson@honda.co.nz
> > > > > > Please ignore my last post - it's wrong. (Answered before verifying).
> > > > > >                  Oct 6 (22 hours ago)
> > > > > >
> > > > > > jthompson@honda.co.nz
> > > > > > Is that litterally what you have in your server.xml?
> > > > > >                  Oct 6 (22 hours ago)
> > > > > >
> > > > > > Eric Wulff
> > > > > > No, literally I have the actual values. The same connection string I
> > > > > > use to s...
> > > > > >                  Oct 6 (22 hours ago)
> > > > > >
> > > > > > jthompson@honda.co.nz
> > > > > > Is there a xxxxx.xml file in (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > > > where xxx...
> > > > > >                  Oct 6 (22 hours ago)
> > > > > >
> > > > > > Eric Wulff
> > > > > > Context name? I assume your referring to the ResourceParams name
> > > > > > attribute, j...
> > > > > >                  Oct 6 (19 hours ago)
> > > > > >
> > > > > > Phillip Qin
> > > > > > <ph...@shareowner.com> to Tomcat
> > > > > >          More options    6:29am (7 hours ago)
> > > > > > Detail, detail, detail.
> > > > > >
> > > > > > 1. your context.xml
> > > > > > 2. your web.xml
> > > > > > 3. how do you obtain connection from pool, java code pls.
> > > > > > 4. can you connect using pool
> > > > > > 5. commons-pool version
> > > > > >
> > > > > > Etc. etc.
> > > > > >
> > > > > > You need to provide details otherwise we can't help.
> > > > > > - Show quoted text -
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > Subject: connection pooling
> > > > > >
> > > > > > Hi all, I have gone over some of the tomcat docs and googled errors
> > > > > > but there is SO much information covering JNDI and Datasources... and
> > > > > > I'm hoping I don't have to be a JNDI/Datasource and XML guru just to
> > > > > > set up db connections via connection pool.
> > > > > >
> > > > > > My situation is this...
> > > > > >
> > > > > > System:
> > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > > Server 9.4 on Windows Server
> > > > > >
> > > > > > -I am able to connect to my db via typical JDBC
> > > > > > DriverManager.getConnection(). -This leads me to believe that my jdbc
> > > > > > driver is in the correct place ...CATALINA
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > > >
> > > > > >
> > > > > >   ReplyForwardInvite Phillip to Gmail
> > > > > > Send  Save Draft  Discard      Check spelling
> > > > > > To:
> > > > > > Cc:
> > > > > > Bcc:
> > > > > >
> > > > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > > > Subject:
> > > > > >
> > > > > > Attach a file
> > > > > >
> > > > > > Send  Save Draft  Discard      Check spelling
> > > > > >
> > > > > > Atishay Kumar
> > > > > > <at...@gmail.com> to Tomcat, me
> > > > > >          More options    6:47am (6 hours ago)
> > > > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff <ew...@gmail.com>
> > > > > > wrote:
> > > > > > > I have gone over some of the tomcat docs and googled errors but
> > > > > > > there is SO much information covering JNDI, connection pooling, and
> > > > > > > Datasources.  Can someone review the info below and consult or point
> > > > > > > me in the right direction?  Although I feel I'm missing something
> > > > > > > obvious, I can't find out what's wrong with my set-up.
> > > > > > >
> > > > > > > thx
> > > > > > > Eric
> > > > > > >
> > > > > > > System:
> > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > > > Server 9.4 on Windows Server
> > > > > > >
> > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > DriverManager.getConnection().  This leads me to believe that my
> > > > > > > informix jdbc driver is in the correct place...
> > > > > > > CATALINA_HOME/common/lib -I have a Context set up in my server.xml
> > > > > > > per examples in a text tutorial I'm referencing
> > > > > > >
> > > > > > > Below listed...
> > > > > > > -errors
> > > > > > > -web.xml
> > > > > > > -server.xml <Context> (minus connection actual values) -.java
> > > > > > >
> > > > > > > exception/errors:
> > > > > > > -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > > > create JDBC driver of class '' for connect URL 'null' SQL state:
> > > > > > > null Error code: 0
> > > > > > >
> > > > > > > -stack trace reveals this, but I can't see why since I have the
> > > > > > > driver in the correct directory...
> > > > > > > java.sql.SQLException: No suitable driver at
> > > > > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > > > ur
> > > > > > > ce.java:773)
> > > > > > >
> > > > > > > web.xml:
> > > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > > <!DOCTYPE web-app
> > > > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > > <web-app>
> > > > > > >         <servlet>
> > > > > > >                 <servlet-name>Test Connection Pooling</servlet-name>
> > > > > > >                 <servlet-class>TestConnectionPooling</servlet-class>
> > > > > > >         </servlet>
> > > > > > >
> > > > > > >         <servlet-mapping>
> > > > > > >                 <servlet-name>Test Connection Pooling</servlet-name>
> > > > > > >                 <url-pattern>/testConnectionPooling</url-pattern>
> > > > > > >         </servlet-mapping>
> > > > > > >
> > > > > > >         <resource-ref>
> > > > > > >           <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > > > >           <res-auth>Container</res-auth>
> > > > > > >         </resource-ref>
> > > > > > > </web-app>
> > > > > > >
> > > > > > > server.xml <Context>:
> > > > > > >   <Context path="/testConnectionPooling"
> > > > > > > docBase="testConnectionPooling" debug="0" reloadable="true">
> > > > > >
> > > > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > > > type="javax.sql.DataSource"/> is missing
> > > > > >
> > > > > > >     <ResourceParams name="jdbc/test_connect">
> > > > > > >       <parameter>
> > > > > > >         <name>username</name>
> > > > > > >         <value>informix</value>
> > > > > > >       </parameter>
> > > > > > >       <parameter>
> > > > > > >         <name>password</name>
> > > > > > >         <value>informix</value>
> > > > > > >       </parameter>
> > > > > > >       <parameter>
> > > > > > >         <name>driverClassName</name>
> > > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > > >       </parameter>
> > > > > > >       <parameter>
> > > > > > >         <name>url</name>
> > > > > > >
> > > > > > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > > /value
> > > > > > >
> > > > > > >       </parameter>
> > > > > > >     </ResourceParams>
> > > > > > >   </Context>
> > > > > > >
> > > > > > > .java:
> > > > > > > import java.io.*;
> > > > > > > import java.sql.*;
> > > > > > > // -Must import javax.naming use JNDI which is required to implement
> > > > > data
> > > > > > > //   resource references and hence connection pooling.
> > > > > > > import javax.naming.*;
> > > > > > > import javax.sql.*;
> > > > > > > import javax.servlet.*;
> > > > > > > import javax.servlet.http.*;
> > > > > > > import java.util.*;
> > > > > > >
> > > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > > >         private DataSource dataSource;
> > > > > > >
> > > > > > >         public void init(ServletConfig config) throws ServletException {
> > > > > > >                 try {
> > > > > > >                         Context init = new InitialContext();
> > > > > > >                         // don't know what the 'java:comp/env' refers to
> > > > > > >                         Context ctx = (Context)
> > > > > > init.lookup("java:comp/env");
> > > > > > >                         // I know "jdbc/conversion must match the
> > > > > > > web.xml res-ref-name of the web.xml but don't know what the path
> > > > > > > really
> > > > > > refers to
> > > > > > >                         dataSource = (DataSource)
> > > > > > ctx.lookup("jdbc/test_connect");
> > > > > > >                 } catch (NamingException ex) {
> > > > > > >                         throw new ServletException("Cannot retrieve
> > > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > > >                 }
> > > > > > >         }
> > > > > > >
> > > > > > >         public void doGet(HttpServletRequest request,
> > > > > > > HttpServletResponse
> > > > > > response)
> > > > > > >         throws ServletException, IOException {
> > > > > > >                 response.setContentType("text/html");
> > > > > > >                 PrintWriter out = response.getWriter();
> > > > > > >                 Connection connection = null;
> > > > > > >                 out.println ("<HTML><HEAD><TITLE>Test Connection
> > > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > > >                 out.println("<H1>Customer Name Query</H1>");
> > > > > > >
> > > > > > >                 try {
> > > > > > >                         synchronized(dataSource) {
> > > > > > >                             connection = dataSource.getConnection();
> > > > > > >                         }
> > > > > > >                         out.println("<br>");
> > > > > > >                         out.println("<strong>Loaded informix driver
> > > > > > > successfully via server.xml.</strong>" +
> > > > > > >                                                 "Now attempting db
> > > > > > connection.");
> > > > > > >                         out.println("<br>");
> > > > > > >                         PreparedStatement pstmt =
> > > > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > > > >                         ResultSet results = pstmt.executeQuery();
> > > > > > >                         if (!results.next()) {
> > > > > > >                                 throw new SQLException("No data
> > > > > > > returned
> > > > > > for some reason");
> > > > > > >                         }
> > > > > > >                         out.println("<br>");
> > > > > > >                         while(results.next()) {
> > > > > > >                                 out.println("<tr><td>" +
> > > > > > results.getString("blah") + "</td></tr>");
> > > > > > >                         }
> > > > > > >         } catch (Exception ex) {
> > > > > > >                         out.println("<br>");
> > > > > > >                         out.println("Exception: " + ex);
> > > > > > >                         if(ex instanceof SQLException) {
> > > > > > >                                 SQLException sqlex = (SQLException) ex;
> > > > > > >                                 out.println("<br>");
> > > > > > >                                 out.println("SQL state:
> > > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > > >                                 out.println("<br>");
> > > > > > >                                 out.println("Error code:
> > > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > > >                                 out.println("<br><br>");
> > > > > > >                                 sqlex.printStackTrace(out);
> > > > > > >                                 out.println("<br><br>");
> > > > > > >                         }
> > > > > > >         }
> > > > > > >         finally {
> > > > > > >             try { connection.close(); } catch (Exception ex) {}
> > > > > > >         }
> > > > > > >                 out.println ("</BODY></HTML>");
> > > > > > >
> > > > > > >
> > > > > > >     }
> > > > > > > }
> > > > > >
> > > > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > > > <ph...@shareowner.com>
> > > > > > wrote:
> > > > > > > Detail, detail, detail.
> > > > > > >
> > > > > > > 1. your context.xml
> > > > > > > 2. your web.xml
> > > > > > > 3. how do you obtain connection from pool, java code pls. 4. can you
> > > > > > > connect using pool 5. commons-pool version
> > > > > > >
> > > > > > > Etc. etc.
> > > > > > >
> > > > > > > You need to provide details otherwise we can't help.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > > Subject: connection pooling
> > > > > > >
> > > > > > > Hi all, I have gone over some of the tomcat docs and googled errors
> > > > > > > but there is SO much information covering JNDI and Datasources...
> > > > > > > and I'm hoping I don't have to be a JNDI/Datasource and XML guru
> > > > > > > just to set up db connections via connection pool.
> > > > > > >
> > > > > > > My situation is this...
> > > > > > >
> > > > > > > System:
> > > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > > > Server 9.4 on Windows Server
> > > > > > >
> > > > > > > -I am able to connect to my db via typical JDBC
> > > > > > > DriverManager.getConnection(). -This leads me to believe that my
> > > > > > > jdbc driver is in the correct place ...CATALINA
> > > > > > >
> > > > > > > --------------------------------------------------------------------
> > > > > > > -
> > > > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > > >
> > > > > > !DSPAM:4165a84c9322136420805!
> > > > > >
> > > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > >
> > > > >
> > > > > !DSPAM:4165bb7715701366110907!
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > >
> > > :)
> > > Atishay Kumar
> > > Btech, SEM VII
> > > DA-IICT
> > > Gandhinagar - 382009
> > > India
> > > ph: +91 9825383948
> > > /****************************************************************************
> > >  * Learn the rules as you would need them to break them properly *
> > >  ****************************************************************************/
> > >
> >
> 
> 
> --
> :)
> Atishay Kumar
> Btech, SEM VII
> DA-IICT
> Gandhinagar - 382009
> India
> ph: +91 9825383948
> /****************************************************************************
>  * Learn the rules as you would need them to break them properly *
>  ****************************************************************************/
> 
> ---------------------------------------------------------------------
> 
> 
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

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


Re: connection pooling

Posted by Atishay Kumar <at...@gmail.com>.
Pls do the following change after <context......> and u are on!!
cheers
On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> Hi all, I'm returning to a problem I couldn't solve the first time,
> about two months ago, and still can't seem to figure out.  I can't get
> a db connection using connection pools.  I get the exception listed
> below, same as so many have previously, but nothing I've found seems
> to works.  Below are my specs.  Anyone with concrete advise/direction
> on how to get
> this working?
> 
> Also, I noticed in many solutions the suggestion was made to edit the
> myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> However, there is no myapp.xml in that directory on my server. Just 2
> .xml's related to other applications and a manager.xml which I'm not
> sure what it's related to.
> 
> OS: FC2
> Tomcat 5.0.28
> 
> exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> JDBC driver class '' for connect URL 'null'
> 
> WEB-INF web xml: code inserted AFTER all servlet mappings...
>         <resource-ref>
>                 <res-ref-name>jdbc/wms</res-ref-name>
>                 <res-type>javax.sql.DataSource</res-type>
>                 <res-auth>Container</res-auth>
>         </resource-ref>
> 
> server xml(tried this with and without a Resource name)...
> <Context path="/wms" docBase="wms" debug="0" reloadable="true">

<Resource name="jdbc/wms" auth="Container" type="javax.sql.DataSource"/>

>     <ResourceParams name="jdbc/wms">
>       <parameter>
>         <name>username</name>
>         <value>whatever</value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>whatever</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>         <value>com.informix.jdbc.IfxDriver</value>
>       </parameter>
>           <parameter>
>                 <name>url</name>
>         <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
>         </parameter>
>     </ResourceParams>
>   </Context>
> 
> I have the following jars in my <CATALINA_HONE>/common/lib and I also
> tried putting the db driver and commons-collections, dbcp, and pool in
> my WEB-INF/lib with no success.  They are all mode 644.
> 
> ant.jar
> ant-launcher.jar
> commons-collections-3.1.jar
> commons-dbcp-1.2.1.jar
> commons-el.jar
> commons-pool-1.2.jar
> ifxjdbc.jar (the necessary informix driver)
> jar.txt
> jasper-compiler.jar
> jasper-runtime.jar
> jsp-api.jar
> mysql-connector-java-3.0.15-ga-bin.jar
> naming-common.jar
> naming-factory.jar
> naming-java.jar
> naming-resources.jar
> servlet-api.jar
> 
> On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> <at...@gmail.com> wrote:
> > hi,
> >  i am not sure but you may try downloading latest jar files for
> > following froom tomcat site and try them out. copy the old jar files
> > somewhere else and try using the latest jar files.
> > 1) Commons Collections
> > 2)Commons DBCP
> > 3)Commons Pool
> >
> >
> >
> >
> > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > > Except that the driver works for connecting if I'm not utilizing a
> > > connection pool, i.e., I am able to connect to the db and manipulate
> > > data via DriverManager.getConnection(url, db, pwd).
> > >
> > > The driver is located in CATALINA_HOME/commons/lib
> > >
> > > Eric
> > >
> > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > <ph...@shareowner.com> wrote:
> > > > No, you don't need that many params. I think your problem might be the
> > >
> > >
> > > > driver. Where did you drop off your informix jdbc jar?
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > Sent: October 7, 2004 5:56 PM
> > > > To: Tomcat Users List
> > > > Subject: Re: connection pooling
> > > >
> > > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > > suggest adding many parameters.  Are they necessary for simply making a
> > > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
> > > > your suggestions out.
> > > > Including the <Resource> tag, but that seems critical for connection.
> > > >
> > > > Eric
> > > >
> > > > On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin <ph...@shareowner.com>
> > > > wrote:
> > > > > 1. web.xml: OK
> > > > >
> > > > > 2. context.xml on <context> of server.xml:
> > > > >
> > > > >         <Resource name="jdbc/test_connect" auth="Container"
> > > > > type="javax.sql.DataSource"/> <= have you added this?
> > > > >         <ResourceParams name="jdbc/test_connect">
> > > > >         <parameter>
> > > > >                 <name>driverClassName</name>
> > > > >                 <value>your.jdbc.driver</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>url</name>
> > > > >                 <value>your.jdbc.url</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>username</name>
> > > > >                 <value>youruser</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>password</name>
> > > > >                 <value>yourpass</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>maxActive</name>
> > > > >                 <value>20</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>maxIdle</name>
> > > > >                 <value>10</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>minIdle</name>
> > > > >                 <value>10</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>maxWait</name>
> > > > >                 <value>15000</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>removeAbandoned</name>
> > > > >                 <value>true</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>validationQuery</name>
> > > > >                 <value>your_query</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>testOnBorrow</name>
> > > > >                 <value>true</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>testOnReturn</name>
> > > > >                 <value>true</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>minEvictableIdleTimeMillis</name>
> > > > >                 <value>-1</value>
> > > > >         </parameter>
> > > > >         <!-- sleeps 5 minutes -->
> > > > >         <parameter>
> > > > >                 <name>timeBetweenEvictionRunsMillis</name>
> > > > >                 <value>300000</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>numTestsPerEvictionRun</name>
> > > > >                 <value>1</value>
> > > > >         </parameter>
> > > > >         <parameter>
> > > > >                 <name>testWhileIdle</name>
> > > > >                 <value>true</value>
> > > > >         </parameter>
> > > > >
> > > > >         </ResourceParams>
> > > > >
> > > > > 3. code
> > > > >
> > > > >                 Context initContext = new InitialContext();
> > > > >                 Context jdbcContext = (Context)
> > > > > initContext.lookup("java:comp/env");
> > > > >                 DataSource dataSource = (DataSource)
> > > > > jdbcContext.lookup("jdbc/test_connect");
> > > > >                 ...
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > Sent: October 7, 2004 4:34 PM
> > > > > To: Tomcat Users List
> > > > > Subject: Re: connection pooling
> > > > >
> > > > > Hi Phillip,
> > > > >
> > > > > On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
> > > > > > Detail, detail, detail.
> > > > > >
> > > > > > 1. your context.xml
> > > > > > 2. your web.xml
> > > > > > 3. how do you obtain connection from pool, java code pls. 4. can you
> > > > > > connect using pool 5. commons-pool version
> > > > > >
> > > > > > Etc. etc.
> > > > > >
> > > > > > You need to provide details otherwise we can't help.
> > > > >
> > > > > This was all included in my original post.  Ok, actually my 2nd post
> > > > > because I accidentally hit send prior to completing my post via the
> > > > > scroll pad on my laptop.  Still, thx for checking on this and the info
> > > > > you looking for is copied again here...
> > > > >
> > > > > System:
> > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > Server 9.4 on Windows Server
> > > > >
> > > > > -I am able to connect to my db via typical JDBC
> > > > > DriverManager.getConnection().  This leads me to believe that my
> > > > > informix jdbc driver is in the correct place...
> > > > > CATALINA_HOME/common/lib -I have a Context set up in my server.xml per
> > > > > examples in a text tutorial I'm referencing
> > > > >
> > > > > Below listed...
> > > > > -errors
> > > > > -web.xml
> > > > > -server.xml <Context> (minus connection actual values)
> > > > > -.java
> > > > >
> > > > > exception/errors:
> > > > > -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create
> > > > > JDBC driver of class '' for connect URL 'null' SQL state: null Error
> > > > > code: 0
> > > > >
> > > > > -stack trace reveals this, but I can't see why since I have the driver
> > > > > in the correct directory...
> > > > > java.sql.SQLException: No suitable driver at
> > > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
> > > > > ce.jav
> > > > > a:773)
> > > > >
> > > > > web.xml:
> > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > <!DOCTYPE web-app
> > > > >    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > > >    "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > <web-app>
> > > > >        <servlet>
> > > > >                <servlet-name>Test Connection Pooling</servlet-name>
> > > > >                <servlet-class>TestConnectionPooling</servlet-class>
> > > > >        </servlet>
> > > > >
> > > > >        <servlet-mapping>
> > > > >                <servlet-name>Test Connection Pooling</servlet-name>
> > > > >                <url-pattern>/testConnectionPooling</url-pattern>
> > > > >        </servlet-mapping>
> > > > >
> > > > >        <resource-ref>
> > > > >          <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > >          <res-type>javax.sql.DataSource</res-type>
> > > > >          <res-auth>Container</res-auth>
> > > > >        </resource-ref>
> > > > > </web-app>
> > > > >
> > > > > server.xml <Context>:
> > > > >  <Context path="/testConnectionPooling"
> > > > > docBase="testConnectionPooling" debug="0" reloadable="true">
> > > > >    <ResourceParams name="jdbc/test_connect">
> > > > >      <parameter>
> > > > >        <name>username</name>
> > > > >        <value>informix</value>
> > > > >      </parameter>
> > > > >      <parameter>
> > > > >        <name>password</name>
> > > > >        <value>informix</value>
> > > > >      </parameter>
> > > > >      <parameter>
> > > > >        <name>driverClassName</name>
> > > > >        <value>com.informix.jdbc.IfxDriver</value>
> > > > >      </parameter>
> > > > >      <parameter>
> > > > >        <name>url</name>
> > > > > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > /value
> > > > > >
> > > > >      </parameter>
> > > > >    </ResourceParams>
> > > > >  </Context>
> > > > >
> > > > > .java:
> > > > > import java.io.*;
> > > > > import java.sql.*;
> > > > > // -Must import javax.naming use JNDI which is required to implement data
> > > > > //   resource references and hence connection pooling.
> > > > > import javax.naming.*;
> > > > > import javax.sql.*;
> > > > > import javax.servlet.*;
> > > > > import javax.servlet.http.*;
> > > > > import java.util.*;
> > > > >
> > > > > public class TestConnectionPooling extends HttpServlet {
> > > > >        private DataSource dataSource;
> > > > >
> > > > >        public void init(ServletConfig config) throws ServletException {
> > > > >                try {
> > > > >                        Context init = new InitialContext();
> > > > >                        // don't know what the 'java:comp/env' refers to
> > > > >                        Context ctx = (Context)
> > > > init.lookup("java:comp/env");
> > > > >                        // I know "jdbc/conversion must match the
> > > > > web.xml res-ref-name of the web.xml but don't know what the path really
> > > > refers to
> > > > >                        dataSource = (DataSource)
> > > > > ctx.lookup("jdbc/test_connect");
> > > > >                } catch (NamingException ex) {
> > > > >                        throw new ServletException("Cannot retrieve
> > > > > java:comp/env/jdbc/test_connect",ex);
> > > > >                }
> > > > >        }
> > > > >
> > > > >        public void doGet(HttpServletRequest request,
> > > > > HttpServletResponse
> > > > > response)
> > > > >        throws ServletException, IOException {
> > > > >                response.setContentType("text/html");
> > > > >                PrintWriter out = response.getWriter();
> > > > >                Connection connection = null;
> > > > >                out.println ("<HTML><HEAD><TITLE>Test Connection
> > > > > Pooling</TITLE></HEAD><BODY>");
> > > > >                out.println("<H1>Customer Name Query</H1>");
> > > > >
> > > > >                try {
> > > > >                        synchronized(dataSource) {
> > > > >                            connection = dataSource.getConnection();
> > > > >                        }
> > > > >                        out.println("<br>");
> > > > >                        out.println("<strong>Loaded informix driver
> > > > > successfully via server.xml.</strong>" +
> > > > >                                                "Now attempting db
> > > > > connection.");
> > > > >                        out.println("<br>");
> > > > >                        PreparedStatement pstmt =
> > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > >                        ResultSet results = pstmt.executeQuery();
> > > > >                        if (!results.next()) {
> > > > >                                throw new SQLException("No data
> > > > > returned for some reason");
> > > > >                        }
> > > > >                        out.println("<br>");
> > > > >                        while(results.next()) {
> > > > >                                out.println("<tr><td>" +
> > > > > results.getString("blah") + "</td></tr>");
> > > > >                        }
> > > > >        } catch (Exception ex) {
> > > > >                        out.println("<br>");
> > > > >                        out.println("Exception: " + ex);
> > > > >                        if(ex instanceof SQLException) {
> > > > >                                SQLException sqlex = (SQLException) ex;
> > > > >                                out.println("<br>");
> > > > >                                out.println("SQL state:
> > > > > "+sqlex.getSQLState()+"<BR>");
> > > > >                                out.println("<br>");
> > > > >                                out.println("Error code:
> > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > >                                out.println("<br><br>");
> > > > >                                sqlex.printStackTrace(out);
> > > > >                                out.println("<br><br>");
> > > > >                        }
> > > > >        }
> > > > >        finally {
> > > > >            try { connection.close(); } catch (Exception ex) {}
> > > > >        }
> > > > >                out.println ("</BODY></HTML>");
> > > > >    }
> > > > > }
> > > > >
> > > > >   ReplyForward
> > > > >
> > > > > jthompson@honda.co.nz
> > > > > java code: Context ctx = (Context) init.lookup("xxxxxx"); server.xml:
> > > > > <Resour...
> > > > >                  Oct 6 (22 hours ago)
> > > > >
> > > > > jthompson@honda.co.nz
> > > > > Please ignore my last post - it's wrong. (Answered before verifying).
> > > > >                  Oct 6 (22 hours ago)
> > > > >
> > > > > jthompson@honda.co.nz
> > > > > Is that litterally what you have in your server.xml?
> > > > >                  Oct 6 (22 hours ago)
> > > > >
> > > > > Eric Wulff
> > > > > No, literally I have the actual values. The same connection string I
> > > > > use to s...
> > > > >                  Oct 6 (22 hours ago)
> > > > >
> > > > > jthompson@honda.co.nz
> > > > > Is there a xxxxx.xml file in (TOMCAT_HOME)/conf/Catalina/localhost,
> > > > > where xxx...
> > > > >                  Oct 6 (22 hours ago)
> > > > >
> > > > > Eric Wulff
> > > > > Context name? I assume your referring to the ResourceParams name
> > > > > attribute, j...
> > > > >                  Oct 6 (19 hours ago)
> > > > >
> > > > > Phillip Qin
> > > > > <ph...@shareowner.com> to Tomcat
> > > > >          More options    6:29am (7 hours ago)
> > > > > Detail, detail, detail.
> > > > >
> > > > > 1. your context.xml
> > > > > 2. your web.xml
> > > > > 3. how do you obtain connection from pool, java code pls.
> > > > > 4. can you connect using pool
> > > > > 5. commons-pool version
> > > > >
> > > > > Etc. etc.
> > > > >
> > > > > You need to provide details otherwise we can't help.
> > > > > - Show quoted text -
> > > > >
> > > > > -----Original Message-----
> > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > Sent: October 6, 2004 5:09 PM
> > > > > To: tomcat-user@jakarta.apache.org
> > > > > Subject: connection pooling
> > > > >
> > > > > Hi all, I have gone over some of the tomcat docs and googled errors
> > > > > but there is SO much information covering JNDI and Datasources... and
> > > > > I'm hoping I don't have to be a JNDI/Datasource and XML guru just to
> > > > > set up db connections via connection pool.
> > > > >
> > > > > My situation is this...
> > > > >
> > > > > System:
> > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > Server 9.4 on Windows Server
> > > > >
> > > > > -I am able to connect to my db via typical JDBC
> > > > > DriverManager.getConnection(). -This leads me to believe that my jdbc
> > > > > driver is in the correct place ...CATALINA
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > >
> > > > >
> > > > >   ReplyForwardInvite Phillip to Gmail
> > > > > Send  Save Draft  Discard      Check spelling
> > > > > To:
> > > > > Cc:
> > > > > Bcc:
> > > > >
> > > > > Add Cc | Add Bcc | Edit Subject | Attach a file
> > > > > Subject:
> > > > >
> > > > > Attach a file
> > > > >
> > > > > Send  Save Draft  Discard      Check spelling
> > > > >
> > > > > Atishay Kumar
> > > > > <at...@gmail.com> to Tomcat, me
> > > > >          More options    6:47am (6 hours ago)
> > > > > On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff <ew...@gmail.com>
> > > > > wrote:
> > > > > > I have gone over some of the tomcat docs and googled errors but
> > > > > > there is SO much information covering JNDI, connection pooling, and
> > > > > > Datasources.  Can someone review the info below and consult or point
> > > > > > me in the right direction?  Although I feel I'm missing something
> > > > > > obvious, I can't find out what's wrong with my set-up.
> > > > > >
> > > > > > thx
> > > > > > Eric
> > > > > >
> > > > > > System:
> > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > > Server 9.4 on Windows Server
> > > > > >
> > > > > > -I am able to connect to my db via typical JDBC
> > > > > > DriverManager.getConnection().  This leads me to believe that my
> > > > > > informix jdbc driver is in the correct place...
> > > > > > CATALINA_HOME/common/lib -I have a Context set up in my server.xml
> > > > > > per examples in a text tutorial I'm referencing
> > > > > >
> > > > > > Below listed...
> > > > > > -errors
> > > > > > -web.xml
> > > > > > -server.xml <Context> (minus connection actual values) -.java
> > > > > >
> > > > > > exception/errors:
> > > > > > -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot
> > > > > > create JDBC driver of class '' for connect URL 'null' SQL state:
> > > > > > null Error code: 0
> > > > > >
> > > > > > -stack trace reveals this, but I can't see why since I have the
> > > > > > driver in the correct directory...
> > > > > > java.sql.SQLException: No suitable driver at
> > > > > > java.sql.DriverManager.getDriver(DriverManager.java:243) at
> > > > > > org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
> > > > > > ur
> > > > > > ce.java:773)
> > > > > >
> > > > > > web.xml:
> > > > > > <?xml version="1.0" encoding="ISO-8859-1"?>
> > > > > > <!DOCTYPE web-app
> > > > > >     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
> > > > > >     "http://java.sun.com/dtd/web-app_2_3.dtd">
> > > > > > <web-app>
> > > > > >         <servlet>
> > > > > >                 <servlet-name>Test Connection Pooling</servlet-name>
> > > > > >                 <servlet-class>TestConnectionPooling</servlet-class>
> > > > > >         </servlet>
> > > > > >
> > > > > >         <servlet-mapping>
> > > > > >                 <servlet-name>Test Connection Pooling</servlet-name>
> > > > > >                 <url-pattern>/testConnectionPooling</url-pattern>
> > > > > >         </servlet-mapping>
> > > > > >
> > > > > >         <resource-ref>
> > > > > >           <res-ref-name>jdbc/test_connect</res-ref-name>
> > > > > >           <res-type>javax.sql.DataSource</res-type>
> > > > > >           <res-auth>Container</res-auth>
> > > > > >         </resource-ref>
> > > > > > </web-app>
> > > > > >
> > > > > > server.xml <Context>:
> > > > > >   <Context path="/testConnectionPooling"
> > > > > > docBase="testConnectionPooling" debug="0" reloadable="true">
> > > > >
> > > > > <Resource name="jdbc/test_connection" auth="Container"
> > > > > type="javax.sql.DataSource"/> is missing
> > > > >
> > > > > >     <ResourceParams name="jdbc/test_connect">
> > > > > >       <parameter>
> > > > > >         <name>username</name>
> > > > > >         <value>informix</value>
> > > > > >       </parameter>
> > > > > >       <parameter>
> > > > > >         <name>password</name>
> > > > > >         <value>informix</value>
> > > > > >       </parameter>
> > > > > >       <parameter>
> > > > > >         <name>driverClassName</name>
> > > > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > > > >       </parameter>
> > > > > >       <parameter>
> > > > > >         <name>url</name>
> > > > > >
> > > > > <value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
> > > > > /value
> > > > > >
> > > > > >       </parameter>
> > > > > >     </ResourceParams>
> > > > > >   </Context>
> > > > > >
> > > > > > .java:
> > > > > > import java.io.*;
> > > > > > import java.sql.*;
> > > > > > // -Must import javax.naming use JNDI which is required to implement
> > > > data
> > > > > > //   resource references and hence connection pooling.
> > > > > > import javax.naming.*;
> > > > > > import javax.sql.*;
> > > > > > import javax.servlet.*;
> > > > > > import javax.servlet.http.*;
> > > > > > import java.util.*;
> > > > > >
> > > > > > public class TestConnectionPooling extends HttpServlet {
> > > > > >         private DataSource dataSource;
> > > > > >
> > > > > >         public void init(ServletConfig config) throws ServletException {
> > > > > >                 try {
> > > > > >                         Context init = new InitialContext();
> > > > > >                         // don't know what the 'java:comp/env' refers to
> > > > > >                         Context ctx = (Context)
> > > > > init.lookup("java:comp/env");
> > > > > >                         // I know "jdbc/conversion must match the
> > > > > > web.xml res-ref-name of the web.xml but don't know what the path
> > > > > > really
> > > > > refers to
> > > > > >                         dataSource = (DataSource)
> > > > > ctx.lookup("jdbc/test_connect");
> > > > > >                 } catch (NamingException ex) {
> > > > > >                         throw new ServletException("Cannot retrieve
> > > > > > java:comp/env/jdbc/test_connect",ex);
> > > > > >                 }
> > > > > >         }
> > > > > >
> > > > > >         public void doGet(HttpServletRequest request,
> > > > > > HttpServletResponse
> > > > > response)
> > > > > >         throws ServletException, IOException {
> > > > > >                 response.setContentType("text/html");
> > > > > >                 PrintWriter out = response.getWriter();
> > > > > >                 Connection connection = null;
> > > > > >                 out.println ("<HTML><HEAD><TITLE>Test Connection
> > > > > > Pooling</TITLE></HEAD><BODY>");
> > > > > >                 out.println("<H1>Customer Name Query</H1>");
> > > > > >
> > > > > >                 try {
> > > > > >                         synchronized(dataSource) {
> > > > > >                             connection = dataSource.getConnection();
> > > > > >                         }
> > > > > >                         out.println("<br>");
> > > > > >                         out.println("<strong>Loaded informix driver
> > > > > > successfully via server.xml.</strong>" +
> > > > > >                                                 "Now attempting db
> > > > > connection.");
> > > > > >                         out.println("<br>");
> > > > > >                         PreparedStatement pstmt =
> > > > > > connection.prepareStatement("SELECT blah FROM blah blah");
> > > > > >                         ResultSet results = pstmt.executeQuery();
> > > > > >                         if (!results.next()) {
> > > > > >                                 throw new SQLException("No data
> > > > > > returned
> > > > > for some reason");
> > > > > >                         }
> > > > > >                         out.println("<br>");
> > > > > >                         while(results.next()) {
> > > > > >                                 out.println("<tr><td>" +
> > > > > results.getString("blah") + "</td></tr>");
> > > > > >                         }
> > > > > >         } catch (Exception ex) {
> > > > > >                         out.println("<br>");
> > > > > >                         out.println("Exception: " + ex);
> > > > > >                         if(ex instanceof SQLException) {
> > > > > >                                 SQLException sqlex = (SQLException) ex;
> > > > > >                                 out.println("<br>");
> > > > > >                                 out.println("SQL state:
> > > > > "+sqlex.getSQLState()+"<BR>");
> > > > > >                                 out.println("<br>");
> > > > > >                                 out.println("Error code:
> > > > > "+sqlex.getErrorCode()+"<BR>");
> > > > > >                                 out.println("<br><br>");
> > > > > >                                 sqlex.printStackTrace(out);
> > > > > >                                 out.println("<br><br>");
> > > > > >                         }
> > > > > >         }
> > > > > >         finally {
> > > > > >             try { connection.close(); } catch (Exception ex) {}
> > > > > >         }
> > > > > >                 out.println ("</BODY></HTML>");
> > > > > >
> > > > > >
> > > > > >     }
> > > > > > }
> > > > >
> > > > > On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
> > > > > <ph...@shareowner.com>
> > > > > wrote:
> > > > > > Detail, detail, detail.
> > > > > >
> > > > > > 1. your context.xml
> > > > > > 2. your web.xml
> > > > > > 3. how do you obtain connection from pool, java code pls. 4. can you
> > > > > > connect using pool 5. commons-pool version
> > > > > >
> > > > > > Etc. etc.
> > > > > >
> > > > > > You need to provide details otherwise we can't help.
> > > > > >
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > Sent: October 6, 2004 5:09 PM
> > > > > > To: tomcat-user@jakarta.apache.org
> > > > > > Subject: connection pooling
> > > > > >
> > > > > > Hi all, I have gone over some of the tomcat docs and googled errors
> > > > > > but there is SO much information covering JNDI and Datasources...
> > > > > > and I'm hoping I don't have to be a JNDI/Datasource and XML guru
> > > > > > just to set up db connections via connection pool.
> > > > > >
> > > > > > My situation is this...
> > > > > >
> > > > > > System:
> > > > > > Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
> > > > > > Server 9.4 on Windows Server
> > > > > >
> > > > > > -I am able to connect to my db via typical JDBC
> > > > > > DriverManager.getConnection(). -This leads me to believe that my
> > > > > > jdbc driver is in the correct place ...CATALINA
> > > > > >
> > > > > > --------------------------------------------------------------------
> > > > > > -
> > > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > > >
> > > > > !DSPAM:4165a84c9322136420805!
> > > > >
> > > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > > >
> > > >
> > > > !DSPAM:4165bb7715701366110907!
> > > >
> > > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> > --
> >
> >
> > :)
> > Atishay Kumar
> > Btech, SEM VII
> > DA-IICT
> > Gandhinagar - 382009
> > India
> > ph: +91 9825383948
> > /****************************************************************************
> >  * Learn the rules as you would need them to break them properly *
> >  ****************************************************************************/
> >
> 


-- 
:)
Atishay Kumar
Btech, SEM VII
DA-IICT
Gandhinagar - 382009
India
ph: +91 9825383948
/****************************************************************************
 * Learn the rules as you would need them to break them properly *
 ****************************************************************************/

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


Re: connection pooling

Posted by V D <st...@drexel.edu>.
How about try to move your application ("wms") out of the webapps 
directory, let's say: c:\wms

Then in the server.xml, try to change docBase in the context:

docBase="c:\wms"

Now, see if your application works or give a different error.  Remember to drop the jdbc library into the common/lib folder.



Eric Wulff wrote:

>Hi all, I'm returning to a problem I couldn't solve the first time,
>about two months ago, and still can't seem to figure out.  I can't get
>a db connection using connection pools.  I get the exception listed
>below, same as so many have previously, but nothing I've found seems
>to works.  Below are my specs.  Anyone with concrete advise/direction
>on how to get
>this working?
>
>Also, I noticed in many solutions the suggestion was made to edit the
>myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. 
>However, there is no myapp.xml in that directory on my server. Just 2
>.xml's related to other applications and a manager.xml which I'm not
>sure what it's related to.
>
>OS: FC2
>Tomcat 5.0.28
>
>exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
>JDBC driver class '' for connect URL 'null'
>
>WEB-INF web xml: code inserted AFTER all servlet mappings...
>	<resource-ref>
>		<res-ref-name>jdbc/wms</res-ref-name>
>		<res-type>javax.sql.DataSource</res-type>
>		<res-auth>Container</res-auth>
>	</resource-ref>
>
>server xml(tried this with and without a Resource name)...
><Context path="/wms" docBase="wms" debug="0" reloadable="true">
>    <ResourceParams name="jdbc/wms">
>      <parameter>
>        <name>username</name>
>        <value>whatever</value>
>      </parameter>
>      <parameter>
>        <name>password</name>
>        <value>whatever</value>
>      </parameter>
>      <parameter>
>        <name>driverClassName</name>
>        <value>com.informix.jdbc.IfxDriver</value>
>      </parameter>
>	  <parameter>
>	 	<name>url</name>
>	<value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
>	</parameter>
>    </ResourceParams>
>  </Context>
>
>I have the following jars in my <CATALINA_HONE>/common/lib and I also
>tried putting the db driver and commons-collections, dbcp, and pool in
>my WEB-INF/lib with no success.  They are all mode 644.
>
>ant.jar
>ant-launcher.jar
>commons-collections-3.1.jar
>commons-dbcp-1.2.1.jar
>commons-el.jar
>commons-pool-1.2.jar
>ifxjdbc.jar (the necessary informix driver)
>jar.txt
>jasper-compiler.jar
>jasper-runtime.jar
>jsp-api.jar
>mysql-connector-java-3.0.15-ga-bin.jar
>naming-common.jar
>naming-factory.jar
>naming-java.jar
>naming-resources.jar
>servlet-api.jar
>
>
>
>On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
><at...@gmail.com> wrote:
>  
>
>>hi,
>> i am not sure but you may try downloading latest jar files for
>>following froom tomcat site and try them out. copy the old jar files
>>somewhere else and try using the latest jar files.
>>1) Commons Collections
>>2)Commons DBCP
>>3)Commons Pool
>>
>>
>>
>>
>>On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
>>    
>>
>>>Except that the driver works for connecting if I'm not utilizing a
>>>connection pool, i.e., I am able to connect to the db and manipulate
>>>data via DriverManager.getConnection(url, db, pwd).
>>>
>>>The driver is located in CATALINA_HOME/commons/lib
>>>
>>>Eric
>>>
>>>On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
>>><ph...@shareowner.com> wrote:
>>>      
>>>
>>>>No, you don't need that many params. I think your problem might be the
>>>>        
>>>>
>>>      
>>>
>>>>driver. Where did you drop off your informix jdbc jar?
>>>>
>>>>
>>>>-----Original Message-----
>>>>From: Eric Wulff [mailto:ewulff@gmail.com]
>>>>Sent: October 7, 2004 5:56 PM
>>>>To: Tomcat Users List
>>>>Subject: Re: connection pooling
>>>>
>>>>Yes, I have added <Resource name=... >.  Now different errors are reported
>>>>via stack trace as I posted in response to Atishay's suggestion that I add
>>>>this.  I'll try adding your suggestions and see what happens.  Also, you
>>>>suggest adding many parameters.  Are they necessary for simply making a
>>>>connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
>>>>your suggestions out.
>>>>Including the <Resource> tag, but that seems critical for connection.
>>>>
>>>>Eric
>>>>
>>>>On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin <ph...@shareowner.com>
>>>>wrote:
>>>>        
>>>>
>>>>>1. web.xml: OK
>>>>>
>>>>>2. context.xml on <context> of server.xml:
>>>>>
>>>>>        <Resource name="jdbc/test_connect" auth="Container"
>>>>>type="javax.sql.DataSource"/> <= have you added this?
>>>>>        <ResourceParams name="jdbc/test_connect">
>>>>>        <parameter>
>>>>>                <name>driverClassName</name>
>>>>>                <value>your.jdbc.driver</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>url</name>
>>>>>                <value>your.jdbc.url</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>username</name>
>>>>>                <value>youruser</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>password</name>
>>>>>                <value>yourpass</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>maxActive</name>
>>>>>                <value>20</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>maxIdle</name>
>>>>>                <value>10</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>minIdle</name>
>>>>>                <value>10</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>maxWait</name>
>>>>>                <value>15000</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>removeAbandoned</name>
>>>>>                <value>true</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>validationQuery</name>
>>>>>                <value>your_query</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>testOnBorrow</name>
>>>>>                <value>true</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>testOnReturn</name>
>>>>>                <value>true</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>minEvictableIdleTimeMillis</name>
>>>>>                <value>-1</value>
>>>>>        </parameter>
>>>>>        <!-- sleeps 5 minutes -->
>>>>>        <parameter>
>>>>>                <name>timeBetweenEvictionRunsMillis</name>
>>>>>                <value>300000</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>numTestsPerEvictionRun</name>
>>>>>                <value>1</value>
>>>>>        </parameter>
>>>>>        <parameter>
>>>>>                <name>testWhileIdle</name>
>>>>>                <value>true</value>
>>>>>        </parameter>
>>>>>
>>>>>        </ResourceParams>
>>>>>
>>>>>3. code
>>>>>
>>>>>                Context initContext = new InitialContext();
>>>>>                Context jdbcContext = (Context)
>>>>>initContext.lookup("java:comp/env");
>>>>>                DataSource dataSource = (DataSource)
>>>>>jdbcContext.lookup("jdbc/test_connect");
>>>>>                ...
>>>>>
>>>>>
>>>>>-----Original Message-----
>>>>>From: Eric Wulff [mailto:ewulff@gmail.com]
>>>>>Sent: October 7, 2004 4:34 PM
>>>>>To: Tomcat Users List
>>>>>Subject: Re: connection pooling
>>>>>
>>>>>Hi Phillip,
>>>>>
>>>>>On Thu, 7 Oct 2004 09:29:09 -0400, you wrote:
>>>>>          
>>>>>
>>>>>>Detail, detail, detail.
>>>>>>
>>>>>>1. your context.xml
>>>>>>2. your web.xml
>>>>>>3. how do you obtain connection from pool, java code pls. 4. can you
>>>>>>connect using pool 5. commons-pool version
>>>>>>
>>>>>>Etc. etc.
>>>>>>
>>>>>>You need to provide details otherwise we can't help.
>>>>>>            
>>>>>>
>>>>>This was all included in my original post.  Ok, actually my 2nd post
>>>>>because I accidentally hit send prior to completing my post via the
>>>>>scroll pad on my laptop.  Still, thx for checking on this and the info
>>>>>you looking for is copied again here...
>>>>>
>>>>>System:
>>>>>Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
>>>>>Server 9.4 on Windows Server
>>>>>
>>>>>-I am able to connect to my db via typical JDBC
>>>>>DriverManager.getConnection().  This leads me to believe that my
>>>>>informix jdbc driver is in the correct place...
>>>>>CATALINA_HOME/common/lib -I have a Context set up in my server.xml per
>>>>>examples in a text tutorial I'm referencing
>>>>>
>>>>>Below listed...
>>>>>-errors
>>>>>-web.xml
>>>>>-server.xml <Context> (minus connection actual values)
>>>>>-.java
>>>>>
>>>>>exception/errors:
>>>>>-Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create
>>>>>JDBC driver of class '' for connect URL 'null' SQL state: null Error
>>>>>code: 0
>>>>>
>>>>>-stack trace reveals this, but I can't see why since I have the driver
>>>>>in the correct directory...
>>>>>java.sql.SQLException: No suitable driver at
>>>>>java.sql.DriverManager.getDriver(DriverManager.java:243) at
>>>>>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour
>>>>>ce.jav
>>>>>a:773)
>>>>>
>>>>>web.xml:
>>>>><?xml version="1.0" encoding="ISO-8859-1"?>
>>>>><!DOCTYPE web-app
>>>>>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>>>>   "http://java.sun.com/dtd/web-app_2_3.dtd">
>>>>><web-app>
>>>>>       <servlet>
>>>>>               <servlet-name>Test Connection Pooling</servlet-name>
>>>>>               <servlet-class>TestConnectionPooling</servlet-class>
>>>>>       </servlet>
>>>>>
>>>>>       <servlet-mapping>
>>>>>               <servlet-name>Test Connection Pooling</servlet-name>
>>>>>               <url-pattern>/testConnectionPooling</url-pattern>
>>>>>       </servlet-mapping>
>>>>>
>>>>>       <resource-ref>
>>>>>         <res-ref-name>jdbc/test_connect</res-ref-name>
>>>>>         <res-type>javax.sql.DataSource</res-type>
>>>>>         <res-auth>Container</res-auth>
>>>>>       </resource-ref>
>>>>></web-app>
>>>>>
>>>>>server.xml <Context>:
>>>>> <Context path="/testConnectionPooling"
>>>>>docBase="testConnectionPooling" debug="0" reloadable="true">
>>>>>   <ResourceParams name="jdbc/test_connect">
>>>>>     <parameter>
>>>>>       <name>username</name>
>>>>>       <value>informix</value>
>>>>>     </parameter>
>>>>>     <parameter>
>>>>>       <name>password</name>
>>>>>       <value>informix</value>
>>>>>     </parameter>
>>>>>     <parameter>
>>>>>       <name>driverClassName</name>
>>>>>       <value>com.informix.jdbc.IfxDriver</value>
>>>>>     </parameter>
>>>>>     <parameter>
>>>>>       <name>url</name>
>>>>><value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
>>>>>/value
>>>>>          
>>>>>
>>>>>     </parameter>
>>>>>   </ResourceParams>
>>>>> </Context>
>>>>>
>>>>>.java:
>>>>>import java.io.*;
>>>>>import java.sql.*;
>>>>>// -Must import javax.naming use JNDI which is required to implement data
>>>>>//   resource references and hence connection pooling.
>>>>>import javax.naming.*;
>>>>>import javax.sql.*;
>>>>>import javax.servlet.*;
>>>>>import javax.servlet.http.*;
>>>>>import java.util.*;
>>>>>
>>>>>public class TestConnectionPooling extends HttpServlet {
>>>>>       private DataSource dataSource;
>>>>>
>>>>>       public void init(ServletConfig config) throws ServletException {
>>>>>               try {
>>>>>                       Context init = new InitialContext();
>>>>>                       // don't know what the 'java:comp/env' refers to
>>>>>                       Context ctx = (Context)
>>>>>          
>>>>>
>>>>init.lookup("java:comp/env");
>>>>        
>>>>
>>>>>                       // I know "jdbc/conversion must match the
>>>>>web.xml res-ref-name of the web.xml but don't know what the path really
>>>>>          
>>>>>
>>>>refers to
>>>>        
>>>>
>>>>>                       dataSource = (DataSource)
>>>>>ctx.lookup("jdbc/test_connect");
>>>>>               } catch (NamingException ex) {
>>>>>                       throw new ServletException("Cannot retrieve
>>>>>java:comp/env/jdbc/test_connect",ex);
>>>>>               }
>>>>>       }
>>>>>
>>>>>       public void doGet(HttpServletRequest request,
>>>>>HttpServletResponse
>>>>>response)
>>>>>       throws ServletException, IOException {
>>>>>               response.setContentType("text/html");
>>>>>               PrintWriter out = response.getWriter();
>>>>>               Connection connection = null;
>>>>>               out.println ("<HTML><HEAD><TITLE>Test Connection
>>>>>Pooling</TITLE></HEAD><BODY>");
>>>>>               out.println("<H1>Customer Name Query</H1>");
>>>>>
>>>>>               try {
>>>>>                       synchronized(dataSource) {
>>>>>                           connection = dataSource.getConnection();
>>>>>                       }
>>>>>                       out.println("<br>");
>>>>>                       out.println("<strong>Loaded informix driver
>>>>>successfully via server.xml.</strong>" +
>>>>>                                               "Now attempting db
>>>>>connection.");
>>>>>                       out.println("<br>");
>>>>>                       PreparedStatement pstmt =
>>>>>connection.prepareStatement("SELECT blah FROM blah blah");
>>>>>                       ResultSet results = pstmt.executeQuery();
>>>>>                       if (!results.next()) {
>>>>>                               throw new SQLException("No data
>>>>>returned for some reason");
>>>>>                       }
>>>>>                       out.println("<br>");
>>>>>                       while(results.next()) {
>>>>>                               out.println("<tr><td>" +
>>>>>results.getString("blah") + "</td></tr>");
>>>>>                       }
>>>>>       } catch (Exception ex) {
>>>>>                       out.println("<br>");
>>>>>                       out.println("Exception: " + ex);
>>>>>                       if(ex instanceof SQLException) {
>>>>>                               SQLException sqlex = (SQLException) ex;
>>>>>                               out.println("<br>");
>>>>>                               out.println("SQL state:
>>>>>"+sqlex.getSQLState()+"<BR>");
>>>>>                               out.println("<br>");
>>>>>                               out.println("Error code:
>>>>>"+sqlex.getErrorCode()+"<BR>");
>>>>>                               out.println("<br><br>");
>>>>>                               sqlex.printStackTrace(out);
>>>>>                               out.println("<br><br>");
>>>>>                       }
>>>>>       }
>>>>>       finally {
>>>>>           try { connection.close(); } catch (Exception ex) {}
>>>>>       }
>>>>>               out.println ("</BODY></HTML>");
>>>>>   }
>>>>>}
>>>>>
>>>>>  ReplyForward
>>>>>
>>>>>jthompson@honda.co.nz
>>>>>java code: Context ctx = (Context) init.lookup("xxxxxx"); server.xml:
>>>>><Resour...
>>>>>                 Oct 6 (22 hours ago)
>>>>>
>>>>>jthompson@honda.co.nz
>>>>>Please ignore my last post - it's wrong. (Answered before verifying).
>>>>>                 Oct 6 (22 hours ago)
>>>>>
>>>>>jthompson@honda.co.nz
>>>>>Is that litterally what you have in your server.xml?
>>>>>                 Oct 6 (22 hours ago)
>>>>>
>>>>>Eric Wulff
>>>>>No, literally I have the actual values. The same connection string I
>>>>>use to s...
>>>>>                 Oct 6 (22 hours ago)
>>>>>
>>>>>jthompson@honda.co.nz
>>>>>Is there a xxxxx.xml file in (TOMCAT_HOME)/conf/Catalina/localhost,
>>>>>where xxx...
>>>>>                 Oct 6 (22 hours ago)
>>>>>
>>>>>Eric Wulff
>>>>>Context name? I assume your referring to the ResourceParams name
>>>>>attribute, j...
>>>>>                 Oct 6 (19 hours ago)
>>>>>
>>>>>Phillip Qin
>>>>><ph...@shareowner.com> to Tomcat
>>>>>         More options    6:29am (7 hours ago)
>>>>>Detail, detail, detail.
>>>>>
>>>>>1. your context.xml
>>>>>2. your web.xml
>>>>>3. how do you obtain connection from pool, java code pls.
>>>>>4. can you connect using pool
>>>>>5. commons-pool version
>>>>>
>>>>>Etc. etc.
>>>>>
>>>>>You need to provide details otherwise we can't help.
>>>>>- Show quoted text -
>>>>>
>>>>>-----Original Message-----
>>>>>From: Eric Wulff [mailto:ewulff@gmail.com]
>>>>>Sent: October 6, 2004 5:09 PM
>>>>>To: tomcat-user@jakarta.apache.org
>>>>>Subject: connection pooling
>>>>>
>>>>>Hi all, I have gone over some of the tomcat docs and googled errors
>>>>>but there is SO much information covering JNDI and Datasources... and
>>>>>I'm hoping I don't have to be a JNDI/Datasource and XML guru just to
>>>>>set up db connections via connection pool.
>>>>>
>>>>>My situation is this...
>>>>>
>>>>>System:
>>>>>Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
>>>>>Server 9.4 on Windows Server
>>>>>
>>>>>-I am able to connect to my db via typical JDBC
>>>>>DriverManager.getConnection(). -This leads me to believe that my jdbc
>>>>>driver is in the correct place ...CATALINA
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>>
>>>>>
>>>>>  ReplyForwardInvite Phillip to Gmail
>>>>>Send  Save Draft  Discard      Check spelling
>>>>>To:
>>>>>Cc:
>>>>>Bcc:
>>>>>
>>>>>Add Cc | Add Bcc | Edit Subject | Attach a file
>>>>>Subject:
>>>>>
>>>>>Attach a file
>>>>>
>>>>>Send  Save Draft  Discard      Check spelling
>>>>>
>>>>>Atishay Kumar
>>>>><at...@gmail.com> to Tomcat, me
>>>>>         More options    6:47am (6 hours ago)
>>>>>On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff <ew...@gmail.com>
>>>>>wrote:
>>>>>          
>>>>>
>>>>>>I have gone over some of the tomcat docs and googled errors but
>>>>>>there is SO much information covering JNDI, connection pooling, and
>>>>>>Datasources.  Can someone review the info below and consult or point
>>>>>>me in the right direction?  Although I feel I'm missing something
>>>>>>obvious, I can't find out what's wrong with my set-up.
>>>>>>
>>>>>>thx
>>>>>>Eric
>>>>>>
>>>>>>System:
>>>>>>Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
>>>>>>Server 9.4 on Windows Server
>>>>>>
>>>>>>-I am able to connect to my db via typical JDBC
>>>>>>DriverManager.getConnection().  This leads me to believe that my
>>>>>>informix jdbc driver is in the correct place...
>>>>>>CATALINA_HOME/common/lib -I have a Context set up in my server.xml
>>>>>>per examples in a text tutorial I'm referencing
>>>>>>
>>>>>>Below listed...
>>>>>>-errors
>>>>>>-web.xml
>>>>>>-server.xml <Context> (minus connection actual values) -.java
>>>>>>
>>>>>>exception/errors:
>>>>>>-Exception: org.apache.commons.dbcp.SQLNestedException: Cannot
>>>>>>create JDBC driver of class '' for connect URL 'null' SQL state:
>>>>>>null Error code: 0
>>>>>>
>>>>>>-stack trace reveals this, but I can't see why since I have the
>>>>>>driver in the correct directory...
>>>>>>java.sql.SQLException: No suitable driver at
>>>>>>java.sql.DriverManager.getDriver(DriverManager.java:243) at
>>>>>>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSo
>>>>>>ur
>>>>>>ce.java:773)
>>>>>>
>>>>>>web.xml:
>>>>>><?xml version="1.0" encoding="ISO-8859-1"?>
>>>>>><!DOCTYPE web-app
>>>>>>    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>>>>>>    "http://java.sun.com/dtd/web-app_2_3.dtd">
>>>>>><web-app>
>>>>>>        <servlet>
>>>>>>                <servlet-name>Test Connection Pooling</servlet-name>
>>>>>>                <servlet-class>TestConnectionPooling</servlet-class>
>>>>>>        </servlet>
>>>>>>
>>>>>>        <servlet-mapping>
>>>>>>                <servlet-name>Test Connection Pooling</servlet-name>
>>>>>>                <url-pattern>/testConnectionPooling</url-pattern>
>>>>>>        </servlet-mapping>
>>>>>>
>>>>>>        <resource-ref>
>>>>>>          <res-ref-name>jdbc/test_connect</res-ref-name>
>>>>>>          <res-type>javax.sql.DataSource</res-type>
>>>>>>          <res-auth>Container</res-auth>
>>>>>>        </resource-ref>
>>>>>></web-app>
>>>>>>
>>>>>>server.xml <Context>:
>>>>>>  <Context path="/testConnectionPooling"
>>>>>>docBase="testConnectionPooling" debug="0" reloadable="true">
>>>>>>            
>>>>>>
>>>>><Resource name="jdbc/test_connection" auth="Container"
>>>>>type="javax.sql.DataSource"/> is missing
>>>>>
>>>>>          
>>>>>
>>>>>>    <ResourceParams name="jdbc/test_connect">
>>>>>>      <parameter>
>>>>>>        <name>username</name>
>>>>>>        <value>informix</value>
>>>>>>      </parameter>
>>>>>>      <parameter>
>>>>>>        <name>password</name>
>>>>>>        <value>informix</value>
>>>>>>      </parameter>
>>>>>>      <parameter>
>>>>>>        <name>driverClassName</name>
>>>>>>        <value>com.informix.jdbc.IfxDriver</value>
>>>>>>      </parameter>
>>>>>>      <parameter>
>>>>>>        <name>url</name>
>>>>>>
>>>>>>            
>>>>>>
>>>>><value>jdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName<
>>>>>/value
>>>>>          
>>>>>
>>>>>>      </parameter>
>>>>>>    </ResourceParams>
>>>>>>  </Context>
>>>>>>
>>>>>>.java:
>>>>>>import java.io.*;
>>>>>>import java.sql.*;
>>>>>>// -Must import javax.naming use JNDI which is required to implement
>>>>>>            
>>>>>>
>>>>data
>>>>        
>>>>
>>>>>>//   resource references and hence connection pooling.
>>>>>>import javax.naming.*;
>>>>>>import javax.sql.*;
>>>>>>import javax.servlet.*;
>>>>>>import javax.servlet.http.*;
>>>>>>import java.util.*;
>>>>>>
>>>>>>public class TestConnectionPooling extends HttpServlet {
>>>>>>        private DataSource dataSource;
>>>>>>
>>>>>>        public void init(ServletConfig config) throws ServletException {
>>>>>>                try {
>>>>>>                        Context init = new InitialContext();
>>>>>>                        // don't know what the 'java:comp/env' refers to
>>>>>>                        Context ctx = (Context)
>>>>>>            
>>>>>>
>>>>>init.lookup("java:comp/env");
>>>>>          
>>>>>
>>>>>>                        // I know "jdbc/conversion must match the
>>>>>>web.xml res-ref-name of the web.xml but don't know what the path
>>>>>>really
>>>>>>            
>>>>>>
>>>>>refers to
>>>>>          
>>>>>
>>>>>>                        dataSource = (DataSource)
>>>>>>            
>>>>>>
>>>>>ctx.lookup("jdbc/test_connect");
>>>>>          
>>>>>
>>>>>>                } catch (NamingException ex) {
>>>>>>                        throw new ServletException("Cannot retrieve
>>>>>>java:comp/env/jdbc/test_connect",ex);
>>>>>>                }
>>>>>>        }
>>>>>>
>>>>>>        public void doGet(HttpServletRequest request,
>>>>>>HttpServletResponse
>>>>>>            
>>>>>>
>>>>>response)
>>>>>          
>>>>>
>>>>>>        throws ServletException, IOException {
>>>>>>                response.setContentType("text/html");
>>>>>>                PrintWriter out = response.getWriter();
>>>>>>                Connection connection = null;
>>>>>>                out.println ("<HTML><HEAD><TITLE>Test Connection
>>>>>>Pooling</TITLE></HEAD><BODY>");
>>>>>>                out.println("<H1>Customer Name Query</H1>");
>>>>>>
>>>>>>                try {
>>>>>>                        synchronized(dataSource) {
>>>>>>                            connection = dataSource.getConnection();
>>>>>>                        }
>>>>>>                        out.println("<br>");
>>>>>>                        out.println("<strong>Loaded informix driver
>>>>>>successfully via server.xml.</strong>" +
>>>>>>                                                "Now attempting db
>>>>>>            
>>>>>>
>>>>>connection.");
>>>>>          
>>>>>
>>>>>>                        out.println("<br>");
>>>>>>                        PreparedStatement pstmt =
>>>>>>connection.prepareStatement("SELECT blah FROM blah blah");
>>>>>>                        ResultSet results = pstmt.executeQuery();
>>>>>>                        if (!results.next()) {
>>>>>>                                throw new SQLException("No data
>>>>>>returned
>>>>>>            
>>>>>>
>>>>>for some reason");
>>>>>          
>>>>>
>>>>>>                        }
>>>>>>                        out.println("<br>");
>>>>>>                        while(results.next()) {
>>>>>>                                out.println("<tr><td>" +
>>>>>>            
>>>>>>
>>>>>results.getString("blah") + "</td></tr>");
>>>>>          
>>>>>
>>>>>>                        }
>>>>>>        } catch (Exception ex) {
>>>>>>                        out.println("<br>");
>>>>>>                        out.println("Exception: " + ex);
>>>>>>                        if(ex instanceof SQLException) {
>>>>>>                                SQLException sqlex = (SQLException) ex;
>>>>>>                                out.println("<br>");
>>>>>>                                out.println("SQL state:
>>>>>>            
>>>>>>
>>>>>"+sqlex.getSQLState()+"<BR>");
>>>>>          
>>>>>
>>>>>>                                out.println("<br>");
>>>>>>                                out.println("Error code:
>>>>>>            
>>>>>>
>>>>>"+sqlex.getErrorCode()+"<BR>");
>>>>>          
>>>>>
>>>>>>                                out.println("<br><br>");
>>>>>>                                sqlex.printStackTrace(out);
>>>>>>                                out.println("<br><br>");
>>>>>>                        }
>>>>>>        }
>>>>>>        finally {
>>>>>>            try { connection.close(); } catch (Exception ex) {}
>>>>>>        }
>>>>>>                out.println ("</BODY></HTML>");
>>>>>>
>>>>>>
>>>>>>    }
>>>>>>}
>>>>>>            
>>>>>>
>>>>>On Thu, 7 Oct 2004 09:29:09 -0400, Phillip Qin
>>>>><ph...@shareowner.com>
>>>>>wrote:
>>>>>          
>>>>>
>>>>>>Detail, detail, detail.
>>>>>>
>>>>>>1. your context.xml
>>>>>>2. your web.xml
>>>>>>3. how do you obtain connection from pool, java code pls. 4. can you
>>>>>>connect using pool 5. commons-pool version
>>>>>>
>>>>>>Etc. etc.
>>>>>>
>>>>>>You need to provide details otherwise we can't help.
>>>>>>
>>>>>>
>>>>>>
>>>>>>-----Original Message-----
>>>>>>From: Eric Wulff [mailto:ewulff@gmail.com]
>>>>>>Sent: October 6, 2004 5:09 PM
>>>>>>To: tomcat-user@jakarta.apache.org
>>>>>>Subject: connection pooling
>>>>>>
>>>>>>Hi all, I have gone over some of the tomcat docs and googled errors
>>>>>>but there is SO much information covering JNDI and Datasources...
>>>>>>and I'm hoping I don't have to be a JNDI/Datasource and XML guru
>>>>>>just to set up db connections via connection pool.
>>>>>>
>>>>>>My situation is this...
>>>>>>
>>>>>>System:
>>>>>>Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic
>>>>>>Server 9.4 on Windows Server
>>>>>>
>>>>>>-I am able to connect to my db via typical JDBC
>>>>>>DriverManager.getConnection(). -This leads me to believe that my
>>>>>>jdbc driver is in the correct place ...CATALINA
>>>>>>
>>>>>>--------------------------------------------------------------------
>>>>>>-
>>>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>            
>>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>>
>>>>>!DSPAM:4165a84c9322136420805!
>>>>>
>>>>>
>>>>>          
>>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>>!DSPAM:4165bb7715701366110907!
>>>>
>>>>
>>>>        
>>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>>      
>>>
>>--
>>
>>
>>:)
>>Atishay Kumar
>>Btech, SEM VII
>>DA-IICT
>>Gandhinagar - 382009
>>India
>>ph: +91 9825383948
>>/****************************************************************************
>> * Learn the rules as you would need them to break them properly *
>> ****************************************************************************/
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>


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


Re: AW: {an alternative}Re: connection pooling

Posted by Ben Souther <bs...@fwdco.com>.
> What escapes me is, why is this not more obviously documented? 
> Perhaps it's in the Tomcat docs but I mostly abandoned those some time
> ago as they are so amazingly detailed and lengthy that unless you want
> to become a TC guru, which I am inspired to try and be more like,
> there is simply too much info.
> 
How can you post a paragraph like that and expect to be taken seriously?
In one breath, you complain about something not being documented, then 
state that you don't read the documentation because it's too detailed?

How can you know what is or isn't obviously documented if you don't read
the documentation?














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


Re: AW: {an alternative}Re: connection pooling

Posted by Eric Wulff <ew...@gmail.com>.
OK - Got It!  Thank you all many times over for your time and help on
this connection pool thing.  It is surprisingly difficult to maintain
a stable environment if you're a curious beginner.  I clearly need to
get a grip on Tomcat's process BUT it also seems abundantly clear that
docs/how to's for simply getting started with connection pools are
less than optimal.  What exactly was my problem?  Still not sure and
trying to narrow it down.  In the hopes of helping anyone on this
list, here's what FINALLY worked for me?

Again, I'm running TC 5.0.28 on Linux FC2

1.   I went in and cleared out ALL my test web-apps, of which I wrote
about 6 different toys via tutorials and on my own.  While I don't
nearly understand the reasons for much of the TC directory structure,
I traversed the following directories and 'rm -r -f' all the webaps I
created and no longer wanted with the thinking that somehow they might
be in the way...

the obvious...
<CATALINA_HOME>/webaps/
the less obvious to me...
<CATALINA_HOME>/work/StandAlone/localhost
<CATALINA_HOME>/work/Catalina/localhost

2.  This, I'm guessing, is more likely the key but I didn't test
between doing all this.  I created a new file, myapp.xml, in...

<CATALINA_HOME>/conf/Catalina/localhost/

and simply copied the related <Context></Context>(see prior emails)
from the server.xml in...
<CATALINA_HOME>/conf/

to this file.

What escapes me is, why is this not more obviously documented? 
Perhaps it's in the Tomcat docs but I mostly abandoned those some time
ago as they are so amazingly detailed and lengthy that unless you want
to become a TC guru, which I am inspired to try and be more like,
there is simply too much info.

Okay, I'm off to continue figuring why TC keeps crashing on me. 
Hopefully something I did here solved that problem too.

thx again all,
Eric

 
On Fri, 5 Nov 2004 08:39:30 +0100, Nick Pellow
<ni...@mindmatics.de> wrote:
> HI Eric,
> 
> I have seen the same error your are getting. I am using tomcat 5.0.28.
> Make sure that you have removed the expanded war directories, from
> "webapps" and ${CATALINA_HOME}/work before restarting.
> 
> Also look inside
> those other context.xmls inside ${CATALINA_HOME}/conf/Catalina/localhost
> and make sure that they do not define a context with path="/wms".
> 
> Cheers,
> nick.
> 
> >-----Ursprungliche Nachricht-----
> >Von: Eric Wulff [mailto:ewulff@gmail.com]
> >Gesendet: Freitag, 5. November 2004 07:35
> >An: Atishay Kumar
> >Cc: Tomcat Users List
> >Betreff: Re: {an alternative}Re: connection pooling
> >
> >
> >Atishay, the DefaultContext does work once I comment out the other
> >Engine element.  You mentioned that means something is wrong with my
> >Context?  So what next?
> >
> >many thx
> >Eric
> >
> >
> >On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff <ew...@gmail.com> wrote:
> >> This did not work.  In looking for the Engine element you speak of I
> >> didn't find it exactly.  I did find it with it with an extra attribute
> >> <Engine name="Standalone"... jvmRoute="jvm1">.  Furthermore, this
> >> element was nested within the <Service> element and there is another
> >> <Engine name="Catalina"...> element.  I tried with and without the
> >> jvmRoute element.  No success.  Same exception.
> >>
> >> Eric
> >>
> >> On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
> >>
> >>
> >> <at...@gmail.com> wrote:
> >> > If adding <Resouce name ......./> did not work..then try following
> >> >
> >> > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> >> > > Hi all, I'm returning to a problem I couldn't solve the first time,
> >> > > about two months ago, and still can't seem to figure out.  I
> >can't get
> >> > > a db connection using connection pools.  I get the exception listed
> >> > > below, same as so many have previously, but nothing I've found seems
> >> > > to works.  Below are my specs.  Anyone with concrete advise/direction
> >> > > on how to get
> >> > > this working?
> >> > >
> >> > > Also, I noticed in many solutions the suggestion was made to edit the
> >> > > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> >> > > However, there is no myapp.xml in that directory on my server. Just 2
> >> > > .xml's related to other applications and a manager.xml which I'm not
> >> > > sure what it's related to.
> >> > >
> >> > > OS: FC2
> >> > > Tomcat 5.0.28
> >> > >
> >> > > exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> >> > > JDBC driver class '' for connect URL 'null'
> >> > >
> >> > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> >> > the following shld be  in
> >> > <web-app>
> >> > >         <resource-ref>
> >> > <description>My Datasource</description>
> >> > >                 <res-ref-name>jdbc/wms</res-ref-name>
> >> > >                 <res-type>javax.sql.DataSource</res-type>
> >> > >                 <res-auth>Container</res-auth>
> >> > >         </resource-ref>
> >> > </web-app> <!-- I am sure u have this right-->
> >> > >
> >> > > server xml(tried this with and without a Resource name)...
> >> > The following shld be under
> >> > <Engine name="Standalone" defaultHost="localhost" debug="0">
> >> >
> >> > REplace
> >> >  <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> >> > with
> >> > <DefaultContext>
> >> > <Resource name="jdbc/wms" auth="Container"
> >type="javax.sql.DataSource"/>
> >> > >     <ResourceParams name="jdbc/wms">
> >> > >       <parameter>
> >> > >         <name>username</name>
> >> > >         <value>whatever</value>
> >> > >       </parameter>
> >> > >       <parameter>
> >> > >         <name>password</name>
> >> > >         <value>whatever</value>
> >> > >       </parameter>
> >> > >       <parameter>
> >> > >         <name>driverClassName</name>
> >> > >         <value>com.informix.jdbc.IfxDriver</value>
> >> > >       </parameter>
> >> > >           <parameter>
> >> > >                 <name>url</name>
> >> > >
> ><value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER
> >VER=serverName</value>
> >> > >         </parameter>
> >> > >     </ResourceParams>
> >> > replace
> >> >    </Context>
> >> > with
> >> > </DefaultContext>
> >> > <!--
> >> > If this works them there is something wrong with your context. we
> >> > shall figure that out later but first <DefaultContext> should work!!
> >> > restart tommy after making changes.
> >> > hope it works!!
> >> > -->
> >> > >
> >> > > I have the following jars in my <CATALINA_HONE>/common/lib and I also
> >> > > tried putting the db driver and commons-collections, dbcp,
> >and pool in
> >> > > my WEB-INF/lib with no success.  They are all mode 644.
> >> > >
> >> > > ant.jar
> >> > > ant-launcher.jar
> >> > > commons-collections-3.1.jar
> >> > > commons-dbcp-1.2.1.jar
> >> > > commons-el.jar
> >> > > commons-pool-1.2.jar
> >> > > ifxjdbc.jar (the necessary informix driver)
> >> > > jar.txt
> >> > > jasper-compiler.jar
> >> > > jasper-runtime.jar
> >> > > jsp-api.jar
> >> > > mysql-connector-java-3.0.15-ga-bin.jar
> >> > > naming-common.jar
> >> > > naming-factory.jar
> >> > > naming-java.jar
> >> > > naming-resources.jar
> >> > > servlet-api.jar
> >> > >
> >> > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> >> > > <at...@gmail.com> wrote:
> >> > > > hi,
> >> > > >  i am not sure but you may try downloading latest jar files for
> >> > > > following froom tomcat site and try them out. copy the old
> >jar files
> >> > > > somewhere else and try using the latest jar files.
> >> > > > 1) Commons Collections
> >> > > > 2)Commons DBCP
> >> > > > 3)Commons Pool
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff
> ><ew...@gmail.com> wrote:
> >> > > > > Except that the driver works for connecting if I'm not
> >utilizing a
> >> > > > > connection pool, i.e., I am able to connect to the db
> >and manipulate
> >> > > > > data via DriverManager.getConnection(url, db, pwd).
> >> > > > >
> >> > > > > The driver is located in CATALINA_HOME/commons/lib
> >> > > > >
> >> > > > > Eric
> >> > > > >
> >> > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> >> > > > > <ph...@shareowner.com> wrote:
> >> > > > > > No, you don't need that many params. I think your
> >problem might be the
> >> > > > >
> >> > > > >
> >> > > > > > driver. Where did you drop off your informix jdbc jar?
> >> > > > > >
> >> > > > > >
> >> > > > > > -----Original Message-----
> >> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> >> > > > > > Sent: October 7, 2004 5:56 PM
> >> > > > > > To: Tomcat Users List
> >> > > > > > Subject: Re: connection pooling
> >> > > > > >
> >> > > > > > Yes, I have added <Resource name=... >.  Now different
> >errors are reported
> >> > > > > > via stack trace as I posted in response to Atishay's
> >suggestion that I add
> >> > > > > > this.  I'll try adding your suggestions and see what
> >happens.  Also, you
> >> > > > > > suggest adding many parameters.  Are they necessary
> >for simply making a
> >> > > > > > connection?  If so, the tutorial I'm following,
> >'Tomcat Kick Start' left all
> >> >
> >> > --
> >> > :)
> >> > Atishay Kumar
> >> > Btech, SEM VII
> >> > DA-IICT
> >> > Gandhinagar - 382009
> >> > India
> >> > ph: +91 9825383948
> >> >
> >/******************************************************************
> >**********
> >> >  * Learn the rules as you would need them to break them properly *
> >> >
> >*******************************************************************
> >*********/
> >> >
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

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


RE: {an alternative}Re: connection pooling

Posted by Steve Kirk <st...@web-startup.co.uk>.
Eric said:
> Also, I noticed in many solutions the suggestion was made to edit the
> myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. 
> However, there is no myapp.xml in that directory on my server. Just 2
> .xml's related to other applications and a manager.xml which I'm not
> sure what it's related to.

when you deploy a "mywebapp" from a warfile that includes a
META-INF/context.xml, TC copies that file to
conf/Catalina/localhost/mywebapp.xml.  having said that there appear to be
situations where TC does and does not copy that file.  all I can say is that
it works for me (5.0.28).

Or, you can create that file yourself.

whichever way it's created, its contents are taken as though they were
inserted as a context under the Catalina/localhost host in server.xml.  this
is the preferred way to config a context since v5.x (rather than putting it
in server.xml).

manager.xml is for the manager webapp.

> -----Original Message-----
> From: Nick Pellow [mailto:nick.pellow@mindmatics.de] 
> Sent: Friday 05 November 2004 07:40
> To: Tomcat Users List
> Subject: AW: {an alternative}Re: connection pooling
> 
> 
> HI Eric,
> 
> 
> I have seen the same error your are getting. I am using tomcat 5.0.28.
> Make sure that you have removed the expanded war directories, from
> "webapps" and ${CATALINA_HOME}/work before restarting.
> 
> Also look inside
> those other context.xmls inside 
> ${CATALINA_HOME}/conf/Catalina/localhost
> and make sure that they do not define a context with path="/wms".
> 
> Cheers,
> nick.
> 
> >-----Ursprungliche Nachricht-----
> >Von: Eric Wulff [mailto:ewulff@gmail.com]
> >Gesendet: Freitag, 5. November 2004 07:35
> >An: Atishay Kumar
> >Cc: Tomcat Users List
> >Betreff: Re: {an alternative}Re: connection pooling
> >
> >
> >Atishay, the DefaultContext does work once I comment out the other
> >Engine element.  You mentioned that means something is wrong with my
> >Context?  So what next?
> >
> >many thx
> >Eric
> >
> >
> >On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff 
> <ew...@gmail.com> wrote:
> >> This did not work.  In looking for the Engine element you 
> speak of I
> >> didn't find it exactly.  I did find it with it with an 
> extra attribute
> >> <Engine name="Standalone"... jvmRoute="jvm1">.  Furthermore, this
> >> element was nested within the <Service> element and there 
> is another
> >> <Engine name="Catalina"...> element.  I tried with and without the
> >> jvmRoute element.  No success.  Same exception.
> >>
> >> Eric
> >>
> >> On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
> >>
> >>
> >> <at...@gmail.com> wrote:
> >> > If adding <Resouce name ......./> did not work..then try 
> following
> >> >
> >> > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff 
> <ew...@gmail.com> wrote:
> >> > > Hi all, I'm returning to a problem I couldn't solve 
> the first time,
> >> > > about two months ago, and still can't seem to figure out.  I
> >can't get
> >> > > a db connection using connection pools.  I get the 
> exception listed
> >> > > below, same as so many have previously, but nothing 
> I've found seems
> >> > > to works.  Below are my specs.  Anyone with concrete 
> advise/direction
> >> > > on how to get
> >> > > this working?
> >> > >
> >> > > Also, I noticed in many solutions the suggestion was 
> made to edit the
> >> > > myapp.xml file located at 
> CATALINA_HOME/conf/Catalina/localhost/.
> >> > > However, there is no myapp.xml in that directory on my 
> server. Just 2
> >> > > .xml's related to other applications and a manager.xml 
> which I'm not
> >> > > sure what it's related to.
> >> > >
> >> > > OS: FC2
> >> > > Tomcat 5.0.28
> >> > >
> >> > > exception: org.apache.commons.dbcp.SWLNestedException: 
> Cannot create
> >> > > JDBC driver class '' for connect URL 'null'
> >> > >
> >> > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> >> > the following shld be  in
> >> > <web-app>
> >> > >         <resource-ref>
> >> > <description>My Datasource</description>
> >> > >                 <res-ref-name>jdbc/wms</res-ref-name>
> >> > >                 <res-type>javax.sql.DataSource</res-type>
> >> > >                 <res-auth>Container</res-auth>
> >> > >         </resource-ref>
> >> > </web-app> <!-- I am sure u have this right-->
> >> > >
> >> > > server xml(tried this with and without a Resource name)...
> >> > The following shld be under
> >> > <Engine name="Standalone" defaultHost="localhost" debug="0">
> >> >
> >> > REplace
> >> >  <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> >> > with
> >> > <DefaultContext>
> >> > <Resource name="jdbc/wms" auth="Container"
> >type="javax.sql.DataSource"/>
> >> > >     <ResourceParams name="jdbc/wms">
> >> > >       <parameter>
> >> > >         <name>username</name>
> >> > >         <value>whatever</value>
> >> > >       </parameter>
> >> > >       <parameter>
> >> > >         <name>password</name>
> >> > >         <value>whatever</value>
> >> > >       </parameter>
> >> > >       <parameter>
> >> > >         <name>driverClassName</name>
> >> > >         <value>com.informix.jdbc.IfxDriver</value>
> >> > >       </parameter>
> >> > >           <parameter>
> >> > >                 <name>url</name>
> >> > >
> ><value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER
> >VER=serverName</value>
> >> > >         </parameter>
> >> > >     </ResourceParams>
> >> > replace
> >> >    </Context>
> >> > with
> >> > </DefaultContext>
> >> > <!--
> >> > If this works them there is something wrong with your context. we
> >> > shall figure that out later but first <DefaultContext> 
> should work!!
> >> > restart tommy after making changes.
> >> > hope it works!!
> >> > -->
> >> > >
> >> > > I have the following jars in my 
> <CATALINA_HONE>/common/lib and I also
> >> > > tried putting the db driver and commons-collections, dbcp,
> >and pool in
> >> > > my WEB-INF/lib with no success.  They are all mode 644.
> >> > >
> >> > > ant.jar
> >> > > ant-launcher.jar
> >> > > commons-collections-3.1.jar
> >> > > commons-dbcp-1.2.1.jar
> >> > > commons-el.jar
> >> > > commons-pool-1.2.jar
> >> > > ifxjdbc.jar (the necessary informix driver)
> >> > > jar.txt
> >> > > jasper-compiler.jar
> >> > > jasper-runtime.jar
> >> > > jsp-api.jar
> >> > > mysql-connector-java-3.0.15-ga-bin.jar
> >> > > naming-common.jar
> >> > > naming-factory.jar
> >> > > naming-java.jar
> >> > > naming-resources.jar
> >> > > servlet-api.jar
> >> > >
> >> > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> >> > > <at...@gmail.com> wrote:
> >> > > > hi,
> >> > > >  i am not sure but you may try downloading latest 
> jar files for
> >> > > > following froom tomcat site and try them out. copy the old
> >jar files
> >> > > > somewhere else and try using the latest jar files.
> >> > > > 1) Commons Collections
> >> > > > 2)Commons DBCP
> >> > > > 3)Commons Pool
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff
> ><ew...@gmail.com> wrote:
> >> > > > > Except that the driver works for connecting if I'm not
> >utilizing a
> >> > > > > connection pool, i.e., I am able to connect to the db
> >and manipulate
> >> > > > > data via DriverManager.getConnection(url, db, pwd).
> >> > > > >
> >> > > > > The driver is located in CATALINA_HOME/commons/lib
> >> > > > >
> >> > > > > Eric
> >> > > > >
> >> > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> >> > > > > <ph...@shareowner.com> wrote:
> >> > > > > > No, you don't need that many params. I think your
> >problem might be the
> >> > > > >
> >> > > > >
> >> > > > > > driver. Where did you drop off your informix jdbc jar?
> >> > > > > >
> >> > > > > >
> >> > > > > > -----Original Message-----
> >> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> >> > > > > > Sent: October 7, 2004 5:56 PM
> >> > > > > > To: Tomcat Users List
> >> > > > > > Subject: Re: connection pooling
> >> > > > > >
> >> > > > > > Yes, I have added <Resource name=... >.  Now different
> >errors are reported
> >> > > > > > via stack trace as I posted in response to Atishay's
> >suggestion that I add
> >> > > > > > this.  I'll try adding your suggestions and see what
> >happens.  Also, you
> >> > > > > > suggest adding many parameters.  Are they necessary
> >for simply making a
> >> > > > > > connection?  If so, the tutorial I'm following,
> >'Tomcat Kick Start' left all
> >> >
> >> > --
> >> > :)
> >> > Atishay Kumar
> >> > Btech, SEM VII
> >> > DA-IICT
> >> > Gandhinagar - 382009
> >> > India
> >> > ph: +91 9825383948
> >> >
> >/******************************************************************
> >**********
> >> >  * Learn the rules as you would need them to break them 
> properly *
> >> >
> >*******************************************************************
> >*********/
> >> >
> >>
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



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


Re: AW: {an alternative}Re: connection pooling

Posted by sven morales <ak...@yahoo.com>.
   I thought I have read back in this same thread that
he had two <Engine> under a <Service> ?  Only one
Engine is allowed per <Service> to fix one problem. 

--- Nick Pellow <ni...@mindmatics.de> wrote:

> HI Eric,
> 
> 
> I have seen the same error your are getting. I am
> using tomcat 5.0.28.
> Make sure that you have removed the expanded war
> directories, from
> "webapps" and ${CATALINA_HOME}/work before
> restarting.
> 
> Also look inside
> those other context.xmls inside
> ${CATALINA_HOME}/conf/Catalina/localhost
> and make sure that they do not define a context with
> path="/wms".
> 
> Cheers,
> nick.
> 
> >-----Ursprungliche Nachricht-----
> >Von: Eric Wulff [mailto:ewulff@gmail.com]
> >Gesendet: Freitag, 5. November 2004 07:35
> >An: Atishay Kumar
> >Cc: Tomcat Users List
> >Betreff: Re: {an alternative}Re: connection pooling
> >
> >
> >Atishay, the DefaultContext does work once I
> comment out the other
> >Engine element.  You mentioned that means something
> is wrong with my
> >Context?  So what next?
> >
> >many thx
> >Eric
> >
> >
> >On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff
> <ew...@gmail.com> wrote:
> >> This did not work.  In looking for the Engine
> element you speak of I
> >> didn't find it exactly.  I did find it with it
> with an extra attribute
> >> <Engine name="Standalone"... jvmRoute="jvm1">. 
> Furthermore, this
> >> element was nested within the <Service> element
> and there is another
> >> <Engine name="Catalina"...> element.  I tried
> with and without the
> >> jvmRoute element.  No success.  Same exception.
> >>
> >> Eric
> >>
> >> On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
> >>
> >>
> >> <at...@gmail.com> wrote:
> >> > If adding <Resouce name ......./> did not
> work..then try following
> >> >
> >> > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff
> <ew...@gmail.com> wrote:
> >> > > Hi all, I'm returning to a problem I couldn't
> solve the first time,
> >> > > about two months ago, and still can't seem to
> figure out.  I
> >can't get
> >> > > a db connection using connection pools.  I
> get the exception listed
> >> > > below, same as so many have previously, but
> nothing I've found seems
> >> > > to works.  Below are my specs.  Anyone with
> concrete advise/direction
> >> > > on how to get
> >> > > this working?
> >> > >
> >> > > Also, I noticed in many solutions the
> suggestion was made to edit the
> >> > > myapp.xml file located at
> CATALINA_HOME/conf/Catalina/localhost/.
> >> > > However, there is no myapp.xml in that
> directory on my server. Just 2
> >> > > .xml's related to other applications and a
> manager.xml which I'm not
> >> > > sure what it's related to.
> >> > >
> >> > > OS: FC2
> >> > > Tomcat 5.0.28
> >> > >
> >> > > exception:
> org.apache.commons.dbcp.SWLNestedException: Cannot
> create
> >> > > JDBC driver class '' for connect URL 'null'
> >> > >
> >> > > WEB-INF web xml: code inserted AFTER all
> servlet mappings...
> >> > the following shld be  in
> >> > <web-app>
> >> > >         <resource-ref>
> >> > <description>My Datasource</description>
> >> > >                
> <res-ref-name>jdbc/wms</res-ref-name>
> >> > >                
> <res-type>javax.sql.DataSource</res-type>
> >> > >                
> <res-auth>Container</res-auth>
> >> > >         </resource-ref>
> >> > </web-app> <!-- I am sure u have this right-->
> >> > >
> >> > > server xml(tried this with and without a
> Resource name)...
> >> > The following shld be under
> >> > <Engine name="Standalone"
> defaultHost="localhost" debug="0">
> >> >
> >> > REplace
> >> >  <Context path="/wms" docBase="wms" debug="0"
> reloadable="true">
> >> > with
> >> > <DefaultContext>
> >> > <Resource name="jdbc/wms" auth="Container"
> >type="javax.sql.DataSource"/>
> >> > >     <ResourceParams name="jdbc/wms">
> >> > >       <parameter>
> >> > >         <name>username</name>
> >> > >         <value>whatever</value>
> >> > >       </parameter>
> >> > >       <parameter>
> >> > >         <name>password</name>
> >> > >         <value>whatever</value>
> >> > >       </parameter>
> >> > >       <parameter>
> >> > >         <name>driverClassName</name>
> >> > >        
> <value>com.informix.jdbc.IfxDriver</value>
> >> > >       </parameter>
> >> > >           <parameter>
> >> > >                 <name>url</name>
> >> > >
>
><value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER
> >VER=serverName</value>
> >> > >         </parameter>
> >> > >     </ResourceParams>
> >> > replace
> >> >    </Context>
> >> > with
> >> > </DefaultContext>
> >> > <!--
> >> > If this works them there is something wrong
> with your context. we
> >> > shall figure that out later but first
> <DefaultContext> should work!!
> >> > restart tommy after making changes.
> >> > hope it works!!
> >> > -->
> >> > >
> >> > > I have the following jars in my
> <CATALINA_HONE>/common/lib and I also
> >> > > tried putting the db driver and
> commons-collections, dbcp,
> >and pool in
> >> > > my WEB-INF/lib with no success.  They are all
> mode 644.
> >> > >
> >> > > ant.jar
> >> > > ant-launcher.jar
> >> > > commons-collections-3.1.jar
> >> > > commons-dbcp-1.2.1.jar
> >> > > commons-el.jar
> >> > > commons-pool-1.2.jar
> >> > > ifxjdbc.jar (the necessary informix driver)
> >> > > jar.txt
> >> > > jasper-compiler.jar
> >> > > jasper-runtime.jar
> >> > > jsp-api.jar
> >> > > mysql-connector-java-3.0.15-ga-bin.jar
> >> > > naming-common.jar
> >> > > naming-factory.jar
> >> > > naming-java.jar
> >> > > naming-resources.jar
> >> > > servlet-api.jar
> >> > >
> >> > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay
> Kumar
> >> > > <at...@gmail.com> wrote:
> >> > > > hi,
> >> > > >  i am not sure but you may try downloading
> latest jar files for
> >> > > > following froom tomcat site and try them
> out. copy the old
> >jar files
> >> > > > somewhere else and try using the latest jar
> files.
> >> > > > 1) Commons Collections
> >> > > > 2)Commons DBCP
> >> > > > 3)Commons Pool
> >> > > >
> >> > > >
> >> > > >
> >> > > >
> >> > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric
> Wulff
> 
=== message truncated ===



		
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 


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


AW: {an alternative}Re: connection pooling

Posted by Nick Pellow <ni...@mindmatics.de>.
HI Eric,


I have seen the same error your are getting. I am using tomcat 5.0.28.
Make sure that you have removed the expanded war directories, from
"webapps" and ${CATALINA_HOME}/work before restarting.

Also look inside
those other context.xmls inside ${CATALINA_HOME}/conf/Catalina/localhost
and make sure that they do not define a context with path="/wms".

Cheers,
nick.

>-----Ursprungliche Nachricht-----
>Von: Eric Wulff [mailto:ewulff@gmail.com]
>Gesendet: Freitag, 5. November 2004 07:35
>An: Atishay Kumar
>Cc: Tomcat Users List
>Betreff: Re: {an alternative}Re: connection pooling
>
>
>Atishay, the DefaultContext does work once I comment out the other
>Engine element.  You mentioned that means something is wrong with my
>Context?  So what next?
>
>many thx
>Eric
>
>
>On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff <ew...@gmail.com> wrote:
>> This did not work.  In looking for the Engine element you speak of I
>> didn't find it exactly.  I did find it with it with an extra attribute
>> <Engine name="Standalone"... jvmRoute="jvm1">.  Furthermore, this
>> element was nested within the <Service> element and there is another
>> <Engine name="Catalina"...> element.  I tried with and without the
>> jvmRoute element.  No success.  Same exception.
>>
>> Eric
>>
>> On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
>>
>>
>> <at...@gmail.com> wrote:
>> > If adding <Resouce name ......./> did not work..then try following
>> >
>> > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
>> > > Hi all, I'm returning to a problem I couldn't solve the first time,
>> > > about two months ago, and still can't seem to figure out.  I
>can't get
>> > > a db connection using connection pools.  I get the exception listed
>> > > below, same as so many have previously, but nothing I've found seems
>> > > to works.  Below are my specs.  Anyone with concrete advise/direction
>> > > on how to get
>> > > this working?
>> > >
>> > > Also, I noticed in many solutions the suggestion was made to edit the
>> > > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
>> > > However, there is no myapp.xml in that directory on my server. Just 2
>> > > .xml's related to other applications and a manager.xml which I'm not
>> > > sure what it's related to.
>> > >
>> > > OS: FC2
>> > > Tomcat 5.0.28
>> > >
>> > > exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
>> > > JDBC driver class '' for connect URL 'null'
>> > >
>> > > WEB-INF web xml: code inserted AFTER all servlet mappings...
>> > the following shld be  in
>> > <web-app>
>> > >         <resource-ref>
>> > <description>My Datasource</description>
>> > >                 <res-ref-name>jdbc/wms</res-ref-name>
>> > >                 <res-type>javax.sql.DataSource</res-type>
>> > >                 <res-auth>Container</res-auth>
>> > >         </resource-ref>
>> > </web-app> <!-- I am sure u have this right-->
>> > >
>> > > server xml(tried this with and without a Resource name)...
>> > The following shld be under
>> > <Engine name="Standalone" defaultHost="localhost" debug="0">
>> >
>> > REplace
>> >  <Context path="/wms" docBase="wms" debug="0" reloadable="true">
>> > with
>> > <DefaultContext>
>> > <Resource name="jdbc/wms" auth="Container"
>type="javax.sql.DataSource"/>
>> > >     <ResourceParams name="jdbc/wms">
>> > >       <parameter>
>> > >         <name>username</name>
>> > >         <value>whatever</value>
>> > >       </parameter>
>> > >       <parameter>
>> > >         <name>password</name>
>> > >         <value>whatever</value>
>> > >       </parameter>
>> > >       <parameter>
>> > >         <name>driverClassName</name>
>> > >         <value>com.informix.jdbc.IfxDriver</value>
>> > >       </parameter>
>> > >           <parameter>
>> > >                 <name>url</name>
>> > >
><value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER
>VER=serverName</value>
>> > >         </parameter>
>> > >     </ResourceParams>
>> > replace
>> >    </Context>
>> > with
>> > </DefaultContext>
>> > <!--
>> > If this works them there is something wrong with your context. we
>> > shall figure that out later but first <DefaultContext> should work!!
>> > restart tommy after making changes.
>> > hope it works!!
>> > -->
>> > >
>> > > I have the following jars in my <CATALINA_HONE>/common/lib and I also
>> > > tried putting the db driver and commons-collections, dbcp,
>and pool in
>> > > my WEB-INF/lib with no success.  They are all mode 644.
>> > >
>> > > ant.jar
>> > > ant-launcher.jar
>> > > commons-collections-3.1.jar
>> > > commons-dbcp-1.2.1.jar
>> > > commons-el.jar
>> > > commons-pool-1.2.jar
>> > > ifxjdbc.jar (the necessary informix driver)
>> > > jar.txt
>> > > jasper-compiler.jar
>> > > jasper-runtime.jar
>> > > jsp-api.jar
>> > > mysql-connector-java-3.0.15-ga-bin.jar
>> > > naming-common.jar
>> > > naming-factory.jar
>> > > naming-java.jar
>> > > naming-resources.jar
>> > > servlet-api.jar
>> > >
>> > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
>> > > <at...@gmail.com> wrote:
>> > > > hi,
>> > > >  i am not sure but you may try downloading latest jar files for
>> > > > following froom tomcat site and try them out. copy the old
>jar files
>> > > > somewhere else and try using the latest jar files.
>> > > > 1) Commons Collections
>> > > > 2)Commons DBCP
>> > > > 3)Commons Pool
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff
><ew...@gmail.com> wrote:
>> > > > > Except that the driver works for connecting if I'm not
>utilizing a
>> > > > > connection pool, i.e., I am able to connect to the db
>and manipulate
>> > > > > data via DriverManager.getConnection(url, db, pwd).
>> > > > >
>> > > > > The driver is located in CATALINA_HOME/commons/lib
>> > > > >
>> > > > > Eric
>> > > > >
>> > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
>> > > > > <ph...@shareowner.com> wrote:
>> > > > > > No, you don't need that many params. I think your
>problem might be the
>> > > > >
>> > > > >
>> > > > > > driver. Where did you drop off your informix jdbc jar?
>> > > > > >
>> > > > > >
>> > > > > > -----Original Message-----
>> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
>> > > > > > Sent: October 7, 2004 5:56 PM
>> > > > > > To: Tomcat Users List
>> > > > > > Subject: Re: connection pooling
>> > > > > >
>> > > > > > Yes, I have added <Resource name=... >.  Now different
>errors are reported
>> > > > > > via stack trace as I posted in response to Atishay's
>suggestion that I add
>> > > > > > this.  I'll try adding your suggestions and see what
>happens.  Also, you
>> > > > > > suggest adding many parameters.  Are they necessary
>for simply making a
>> > > > > > connection?  If so, the tutorial I'm following,
>'Tomcat Kick Start' left all
>> >
>> > --
>> > :)
>> > Atishay Kumar
>> > Btech, SEM VII
>> > DA-IICT
>> > Gandhinagar - 382009
>> > India
>> > ph: +91 9825383948
>> >
>/******************************************************************
>**********
>> >  * Learn the rules as you would need them to break them properly *
>> >
>*******************************************************************
>*********/
>> >
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>



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


Re: {an alternative}Re: connection pooling

Posted by Atishay Kumar <at...@gmail.com>.
On Thu, 4 Nov 2004 22:35:16 -0800, Eric Wulff <ew...@gmail.com> wrote:
> Atishay, the DefaultContext does work once I comment out the other
> Engine element.  You mentioned that means something is wrong with my
> Context?  So what next?
sorry for replying late? was bit bize!
can u send your complete server.xml and web.xml file as attachment. it
attachments r not allowed then copy paste the files. If some of us
glance over it, then we might be able to figure out the real problem.
Atishay
> 
> many thx
> Eric
> 
> 
> 
> 
> On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff <ew...@gmail.com> wrote:
> > This did not work.  In looking for the Engine element you speak of I
> > didn't find it exactly.  I did find it with it with an extra attribute
> > <Engine name="Standalone"... jvmRoute="jvm1">.  Furthermore, this
> > element was nested within the <Service> element and there is another
> > <Engine name="Catalina"...> element.  I tried with and without the
> > jvmRoute element.  No success.  Same exception.
> >
> > Eric
> >
> > On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
> >
> >
> > <at...@gmail.com> wrote:
> > > If adding <Resouce name ......./> did not work..then try following
> > >
> > > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> > > > Hi all, I'm returning to a problem I couldn't solve the first time,
> > > > about two months ago, and still can't seem to figure out.  I can't get
> > > > a db connection using connection pools.  I get the exception listed
> > > > below, same as so many have previously, but nothing I've found seems
> > > > to works.  Below are my specs.  Anyone with concrete advise/direction
> > > > on how to get
> > > > this working?
> > > >
> > > > Also, I noticed in many solutions the suggestion was made to edit the
> > > > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> > > > However, there is no myapp.xml in that directory on my server. Just 2
> > > > .xml's related to other applications and a manager.xml which I'm not
> > > > sure what it's related to.
> > > >
> > > > OS: FC2
> > > > Tomcat 5.0.28
> > > >
> > > > exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> > > > JDBC driver class '' for connect URL 'null'
> > > >
> > > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> > > the following shld be  in
> > > <web-app>
> > > >         <resource-ref>
> > > <description>My Datasource</description>
> > > >                 <res-ref-name>jdbc/wms</res-ref-name>
> > > >                 <res-type>javax.sql.DataSource</res-type>
> > > >                 <res-auth>Container</res-auth>
> > > >         </resource-ref>
> > > </web-app> <!-- I am sure u have this right-->
> > > >
> > > > server xml(tried this with and without a Resource name)...
> > > The following shld be under
> > > <Engine name="Standalone" defaultHost="localhost" debug="0">
> > >
> > > REplace
> > >  <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> > > with
> > > <DefaultContext>
> > > <Resource name="jdbc/wms" auth="Container" type="javax.sql.DataSource"/>
> > > >     <ResourceParams name="jdbc/wms">
> > > >       <parameter>
> > > >         <name>username</name>
> > > >         <value>whatever</value>
> > > >       </parameter>
> > > >       <parameter>
> > > >         <name>password</name>
> > > >         <value>whatever</value>
> > > >       </parameter>
> > > >       <parameter>
> > > >         <name>driverClassName</name>
> > > >         <value>com.informix.jdbc.IfxDriver</value>
> > > >       </parameter>
> > > >           <parameter>
> > > >                 <name>url</name>
> > > >         <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
> > > >         </parameter>
> > > >     </ResourceParams>
> > > replace
> > >    </Context>
> > > with
> > > </DefaultContext>
> > > <!--
> > > If this works them there is something wrong with your context. we
> > > shall figure that out later but first <DefaultContext> should work!!
> > > restart tommy after making changes.
> > > hope it works!!
> > > -->
> > > >
> > > > I have the following jars in my <CATALINA_HONE>/common/lib and I also
> > > > tried putting the db driver and commons-collections, dbcp, and pool in
> > > > my WEB-INF/lib with no success.  They are all mode 644.
> > > >
> > > > ant.jar
> > > > ant-launcher.jar
> > > > commons-collections-3.1.jar
> > > > commons-dbcp-1.2.1.jar
> > > > commons-el.jar
> > > > commons-pool-1.2.jar
> > > > ifxjdbc.jar (the necessary informix driver)
> > > > jar.txt
> > > > jasper-compiler.jar
> > > > jasper-runtime.jar
> > > > jsp-api.jar
> > > > mysql-connector-java-3.0.15-ga-bin.jar
> > > > naming-common.jar
> > > > naming-factory.jar
> > > > naming-java.jar
> > > > naming-resources.jar
> > > > servlet-api.jar
> > > >
> > > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > > > <at...@gmail.com> wrote:
> > > > > hi,
> > > > >  i am not sure but you may try downloading latest jar files for
> > > > > following froom tomcat site and try them out. copy the old jar files
> > > > > somewhere else and try using the latest jar files.
> > > > > 1) Commons Collections
> > > > > 2)Commons DBCP
> > > > > 3)Commons Pool
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > > > > > Except that the driver works for connecting if I'm not utilizing a
> > > > > > connection pool, i.e., I am able to connect to the db and manipulate
> > > > > > data via DriverManager.getConnection(url, db, pwd).
> > > > > >
> > > > > > The driver is located in CATALINA_HOME/commons/lib
> > > > > >
> > > > > > Eric
> > > > > >
> > > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > > > <ph...@shareowner.com> wrote:
> > > > > > > No, you don't need that many params. I think your problem might be the
> > > > > >
> > > > > >
> > > > > > > driver. Where did you drop off your informix jdbc jar?
> > > > > > >
> > > > > > >
> > > > > > > -----Original Message-----
> > > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > > Sent: October 7, 2004 5:56 PM
> > > > > > > To: Tomcat Users List
> > > > > > > Subject: Re: connection pooling
> > > > > > >
> > > > > > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > > > > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > > > > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > > > > > suggest adding many parameters.  Are they necessary for simply making a
> > > > > > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
> > >
> > > --
> > > :)
> > > Atishay Kumar
> > > Btech, SEM VII
> > > DA-IICT
> > > Gandhinagar - 382009
> > > India
> > > ph: +91 9825383948
> > > /****************************************************************************
> > >  * Learn the rules as you would need them to break them properly *
> > >  ****************************************************************************/
> > >
> >
> 


-- 
:)
Atishay Kumar
Btech, SEM VII
DA-IICT
Gandhinagar - 382009
India
ph: +91 9825383948
/****************************************************************************
 * Learn the rules as you would need them to break them properly *
 ****************************************************************************/

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


Re: {an alternative}Re: connection pooling

Posted by Eric Wulff <ew...@gmail.com>.
Atishay, the DefaultContext does work once I comment out the other
Engine element.  You mentioned that means something is wrong with my
Context?  So what next?

many thx
Eric


On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff <ew...@gmail.com> wrote:
> This did not work.  In looking for the Engine element you speak of I
> didn't find it exactly.  I did find it with it with an extra attribute
> <Engine name="Standalone"... jvmRoute="jvm1">.  Furthermore, this
> element was nested within the <Service> element and there is another
> <Engine name="Catalina"...> element.  I tried with and without the
> jvmRoute element.  No success.  Same exception.
> 
> Eric
> 
> On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
> 
> 
> <at...@gmail.com> wrote:
> > If adding <Resouce name ......./> did not work..then try following
> >
> > On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> > > Hi all, I'm returning to a problem I couldn't solve the first time,
> > > about two months ago, and still can't seem to figure out.  I can't get
> > > a db connection using connection pools.  I get the exception listed
> > > below, same as so many have previously, but nothing I've found seems
> > > to works.  Below are my specs.  Anyone with concrete advise/direction
> > > on how to get
> > > this working?
> > >
> > > Also, I noticed in many solutions the suggestion was made to edit the
> > > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> > > However, there is no myapp.xml in that directory on my server. Just 2
> > > .xml's related to other applications and a manager.xml which I'm not
> > > sure what it's related to.
> > >
> > > OS: FC2
> > > Tomcat 5.0.28
> > >
> > > exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> > > JDBC driver class '' for connect URL 'null'
> > >
> > > WEB-INF web xml: code inserted AFTER all servlet mappings...
> > the following shld be  in
> > <web-app>
> > >         <resource-ref>
> > <description>My Datasource</description>
> > >                 <res-ref-name>jdbc/wms</res-ref-name>
> > >                 <res-type>javax.sql.DataSource</res-type>
> > >                 <res-auth>Container</res-auth>
> > >         </resource-ref>
> > </web-app> <!-- I am sure u have this right-->
> > >
> > > server xml(tried this with and without a Resource name)...
> > The following shld be under
> > <Engine name="Standalone" defaultHost="localhost" debug="0">
> >
> > REplace
> >  <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> > with
> > <DefaultContext>
> > <Resource name="jdbc/wms" auth="Container" type="javax.sql.DataSource"/>
> > >     <ResourceParams name="jdbc/wms">
> > >       <parameter>
> > >         <name>username</name>
> > >         <value>whatever</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>password</name>
> > >         <value>whatever</value>
> > >       </parameter>
> > >       <parameter>
> > >         <name>driverClassName</name>
> > >         <value>com.informix.jdbc.IfxDriver</value>
> > >       </parameter>
> > >           <parameter>
> > >                 <name>url</name>
> > >         <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
> > >         </parameter>
> > >     </ResourceParams>
> > replace
> >    </Context>
> > with
> > </DefaultContext>
> > <!--
> > If this works them there is something wrong with your context. we
> > shall figure that out later but first <DefaultContext> should work!!
> > restart tommy after making changes.
> > hope it works!!
> > -->
> > >
> > > I have the following jars in my <CATALINA_HONE>/common/lib and I also
> > > tried putting the db driver and commons-collections, dbcp, and pool in
> > > my WEB-INF/lib with no success.  They are all mode 644.
> > >
> > > ant.jar
> > > ant-launcher.jar
> > > commons-collections-3.1.jar
> > > commons-dbcp-1.2.1.jar
> > > commons-el.jar
> > > commons-pool-1.2.jar
> > > ifxjdbc.jar (the necessary informix driver)
> > > jar.txt
> > > jasper-compiler.jar
> > > jasper-runtime.jar
> > > jsp-api.jar
> > > mysql-connector-java-3.0.15-ga-bin.jar
> > > naming-common.jar
> > > naming-factory.jar
> > > naming-java.jar
> > > naming-resources.jar
> > > servlet-api.jar
> > >
> > > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > > <at...@gmail.com> wrote:
> > > > hi,
> > > >  i am not sure but you may try downloading latest jar files for
> > > > following froom tomcat site and try them out. copy the old jar files
> > > > somewhere else and try using the latest jar files.
> > > > 1) Commons Collections
> > > > 2)Commons DBCP
> > > > 3)Commons Pool
> > > >
> > > >
> > > >
> > > >
> > > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > > > > Except that the driver works for connecting if I'm not utilizing a
> > > > > connection pool, i.e., I am able to connect to the db and manipulate
> > > > > data via DriverManager.getConnection(url, db, pwd).
> > > > >
> > > > > The driver is located in CATALINA_HOME/commons/lib
> > > > >
> > > > > Eric
> > > > >
> > > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > > <ph...@shareowner.com> wrote:
> > > > > > No, you don't need that many params. I think your problem might be the
> > > > >
> > > > >
> > > > > > driver. Where did you drop off your informix jdbc jar?
> > > > > >
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > > Sent: October 7, 2004 5:56 PM
> > > > > > To: Tomcat Users List
> > > > > > Subject: Re: connection pooling
> > > > > >
> > > > > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > > > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > > > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > > > > suggest adding many parameters.  Are they necessary for simply making a
> > > > > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
> >
> > --
> > :)
> > Atishay Kumar
> > Btech, SEM VII
> > DA-IICT
> > Gandhinagar - 382009
> > India
> > ph: +91 9825383948
> > /****************************************************************************
> >  * Learn the rules as you would need them to break them properly *
> >  ****************************************************************************/
> >
>

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


Re: {an alternative}Re: connection pooling

Posted by Eric Wulff <ew...@gmail.com>.
This did not work.  In looking for the Engine element you speak of I
didn't find it exactly.  I did find it with it with an extra attribute
<Engine name="Standalone"... jvmRoute="jvm1">.  Furthermore, this
element was nested within the <Service> element and there is another
<Engine name="Catalina"...> element.  I tried with and without the
jvmRoute element.  No success.  Same exception.

Eric


On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar
<at...@gmail.com> wrote:
> If adding <Resouce name ......./> did not work..then try following
> 
> On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> > Hi all, I'm returning to a problem I couldn't solve the first time,
> > about two months ago, and still can't seem to figure out.  I can't get
> > a db connection using connection pools.  I get the exception listed
> > below, same as so many have previously, but nothing I've found seems
> > to works.  Below are my specs.  Anyone with concrete advise/direction
> > on how to get
> > this working?
> >
> > Also, I noticed in many solutions the suggestion was made to edit the
> > myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> > However, there is no myapp.xml in that directory on my server. Just 2
> > .xml's related to other applications and a manager.xml which I'm not
> > sure what it's related to.
> >
> > OS: FC2
> > Tomcat 5.0.28
> >
> > exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> > JDBC driver class '' for connect URL 'null'
> >
> > WEB-INF web xml: code inserted AFTER all servlet mappings...
> the following shld be  in
> <web-app>
> >         <resource-ref>
> <description>My Datasource</description>
> >                 <res-ref-name>jdbc/wms</res-ref-name>
> >                 <res-type>javax.sql.DataSource</res-type>
> >                 <res-auth>Container</res-auth>
> >         </resource-ref>
> </web-app> <!-- I am sure u have this right-->
> >
> > server xml(tried this with and without a Resource name)...
> The following shld be under
> <Engine name="Standalone" defaultHost="localhost" debug="0">
> 
> REplace
>  <Context path="/wms" docBase="wms" debug="0" reloadable="true">
> with
> <DefaultContext>
> <Resource name="jdbc/wms" auth="Container" type="javax.sql.DataSource"/>
> >     <ResourceParams name="jdbc/wms">
> >       <parameter>
> >         <name>username</name>
> >         <value>whatever</value>
> >       </parameter>
> >       <parameter>
> >         <name>password</name>
> >         <value>whatever</value>
> >       </parameter>
> >       <parameter>
> >         <name>driverClassName</name>
> >         <value>com.informix.jdbc.IfxDriver</value>
> >       </parameter>
> >           <parameter>
> >                 <name>url</name>
> >         <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
> >         </parameter>
> >     </ResourceParams>
> replace
>    </Context>
> with
> </DefaultContext>
> <!--
> If this works them there is something wrong with your context. we
> shall figure that out later but first <DefaultContext> should work!!
> restart tommy after making changes.
> hope it works!!
> -->
> >
> > I have the following jars in my <CATALINA_HONE>/common/lib and I also
> > tried putting the db driver and commons-collections, dbcp, and pool in
> > my WEB-INF/lib with no success.  They are all mode 644.
> >
> > ant.jar
> > ant-launcher.jar
> > commons-collections-3.1.jar
> > commons-dbcp-1.2.1.jar
> > commons-el.jar
> > commons-pool-1.2.jar
> > ifxjdbc.jar (the necessary informix driver)
> > jar.txt
> > jasper-compiler.jar
> > jasper-runtime.jar
> > jsp-api.jar
> > mysql-connector-java-3.0.15-ga-bin.jar
> > naming-common.jar
> > naming-factory.jar
> > naming-java.jar
> > naming-resources.jar
> > servlet-api.jar
> >
> > On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> > <at...@gmail.com> wrote:
> > > hi,
> > >  i am not sure but you may try downloading latest jar files for
> > > following froom tomcat site and try them out. copy the old jar files
> > > somewhere else and try using the latest jar files.
> > > 1) Commons Collections
> > > 2)Commons DBCP
> > > 3)Commons Pool
> > >
> > >
> > >
> > >
> > > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > > > Except that the driver works for connecting if I'm not utilizing a
> > > > connection pool, i.e., I am able to connect to the db and manipulate
> > > > data via DriverManager.getConnection(url, db, pwd).
> > > >
> > > > The driver is located in CATALINA_HOME/commons/lib
> > > >
> > > > Eric
> > > >
> > > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > > <ph...@shareowner.com> wrote:
> > > > > No, you don't need that many params. I think your problem might be the
> > > >
> > > >
> > > > > driver. Where did you drop off your informix jdbc jar?
> > > > >
> > > > >
> > > > > -----Original Message-----
> > > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > > Sent: October 7, 2004 5:56 PM
> > > > > To: Tomcat Users List
> > > > > Subject: Re: connection pooling
> > > > >
> > > > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > > > suggest adding many parameters.  Are they necessary for simply making a
> > > > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all
> 
> --
> :)
> Atishay Kumar
> Btech, SEM VII
> DA-IICT
> Gandhinagar - 382009
> India
> ph: +91 9825383948
> /****************************************************************************
>  * Learn the rules as you would need them to break them properly *
>  ****************************************************************************/
>

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


{an alternative}Re: connection pooling

Posted by Atishay Kumar <at...@gmail.com>.
If adding <Resouce name ......./> did not work..then try following

On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff <ew...@gmail.com> wrote:
> Hi all, I'm returning to a problem I couldn't solve the first time,
> about two months ago, and still can't seem to figure out.  I can't get
> a db connection using connection pools.  I get the exception listed
> below, same as so many have previously, but nothing I've found seems
> to works.  Below are my specs.  Anyone with concrete advise/direction
> on how to get
> this working?
> 
> Also, I noticed in many solutions the suggestion was made to edit the
> myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/.
> However, there is no myapp.xml in that directory on my server. Just 2
> .xml's related to other applications and a manager.xml which I'm not
> sure what it's related to.
> 
> OS: FC2
> Tomcat 5.0.28
> 
> exception: org.apache.commons.dbcp.SWLNestedException: Cannot create
> JDBC driver class '' for connect URL 'null'
> 
> WEB-INF web xml: code inserted AFTER all servlet mappings...
the following shld be  in 
<web-app>
>         <resource-ref>
<description>My Datasource</description>
>                 <res-ref-name>jdbc/wms</res-ref-name>
>                 <res-type>javax.sql.DataSource</res-type>
>                 <res-auth>Container</res-auth>
>         </resource-ref>
</web-app> <!-- I am sure u have this right-->
> 
> server xml(tried this with and without a Resource name)...
The following shld be under 
<Engine name="Standalone" defaultHost="localhost" debug="0">

REplace
 <Context path="/wms" docBase="wms" debug="0" reloadable="true">
with
<DefaultContext>
<Resource name="jdbc/wms" auth="Container" type="javax.sql.DataSource"/>
>     <ResourceParams name="jdbc/wms">
>       <parameter>
>         <name>username</name>
>         <value>whatever</value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>whatever</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>         <value>com.informix.jdbc.IfxDriver</value>
>       </parameter>
>           <parameter>
>                 <name>url</name>
>         <value>jdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName</value>
>         </parameter>
>     </ResourceParams>
replace
   </Context>
with
</DefaultContext>
<!--
If this works them there is something wrong with your context. we
shall figure that out later but first <DefaultContext> should work!!
restart tommy after making changes.
hope it works!!
-->
> 
> I have the following jars in my <CATALINA_HONE>/common/lib and I also
> tried putting the db driver and commons-collections, dbcp, and pool in
> my WEB-INF/lib with no success.  They are all mode 644.
> 
> ant.jar
> ant-launcher.jar
> commons-collections-3.1.jar
> commons-dbcp-1.2.1.jar
> commons-el.jar
> commons-pool-1.2.jar
> ifxjdbc.jar (the necessary informix driver)
> jar.txt
> jasper-compiler.jar
> jasper-runtime.jar
> jsp-api.jar
> mysql-connector-java-3.0.15-ga-bin.jar
> naming-common.jar
> naming-factory.jar
> naming-java.jar
> naming-resources.jar
> servlet-api.jar
> 
> On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar
> <at...@gmail.com> wrote:
> > hi,
> >  i am not sure but you may try downloading latest jar files for
> > following froom tomcat site and try them out. copy the old jar files
> > somewhere else and try using the latest jar files.
> > 1) Commons Collections
> > 2)Commons DBCP
> > 3)Commons Pool
> >
> >
> >
> >
> > On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff <ew...@gmail.com> wrote:
> > > Except that the driver works for connecting if I'm not utilizing a
> > > connection pool, i.e., I am able to connect to the db and manipulate
> > > data via DriverManager.getConnection(url, db, pwd).
> > >
> > > The driver is located in CATALINA_HOME/commons/lib
> > >
> > > Eric
> > >
> > > On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin
> > > <ph...@shareowner.com> wrote:
> > > > No, you don't need that many params. I think your problem might be the
> > >
> > >
> > > > driver. Where did you drop off your informix jdbc jar?
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Eric Wulff [mailto:ewulff@gmail.com]
> > > > Sent: October 7, 2004 5:56 PM
> > > > To: Tomcat Users List
> > > > Subject: Re: connection pooling
> > > >
> > > > Yes, I have added <Resource name=... >.  Now different errors are reported
> > > > via stack trace as I posted in response to Atishay's suggestion that I add
> > > > this.  I'll try adding your suggestions and see what happens.  Also, you
> > > > suggest adding many parameters.  Are they necessary for simply making a
> > > > connection?  If so, the tutorial I'm following, 'Tomcat Kick Start' left all



-- 
:)
Atishay Kumar
Btech, SEM VII
DA-IICT
Gandhinagar - 382009
India
ph: +91 9825383948
/****************************************************************************
 * Learn the rules as you would need them to break them properly *
 ****************************************************************************/

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