Hi,
Here's a thought: since you're already declining to use tomcat's
built-in DBCP support, why not go really portable and do the pooling
yourself in your own app?  (This would necessitate zero or little code
writing on your behalf).

Yes, you'd have environment-specific WAR files, but the overall
development, deployment, and configuration is much simpler and easier to
debug.  And you'd be server-agnostic!

Just a thought...

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: David Smith [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, March 09, 2004 11:25 AM
>To: Tomcat Users List
>Subject: Re: JNDI Datasource Reference in DD Not Necessary?
>
>> Despite my posting - and I really hope someone chips in concerning
the
>> question I raised about the <resource-ref> being redundant in the
>deployment
>> descriptor (!) - the first thing to say is, have faith!
>>
>> Connection pooling works, and it is actually quite simple, so do not
give
>up
>> on it.
>
>Cheers for the advice Harry... here's where I'm at....
>
>I have no choice on the giving up side of things, need to implement it
>for some client code I'm working on
>
>;-)
>
>I've been doing a lot of googling to try and get answers so I may have
>got crossed wires, I had a version working (or thinking it was working)
>with the info in $JAKARTA_HOME/conf/server.xml but I wasn't happy with
>this solution (preferring to have the connection defined in
>$JAKARTA_HOME/conf/Catalina/localhost/<app_name>.xml for good
reasons...
>
>so I'm basically restarting and I now have the following config
>
>$JAKARTA_HOME/conf/Catalina/localhost/<app_name>.xml
>
><?xml version='1.0' encoding='utf-8'?>
><Context docBase="dev-sstl" path="/dev-sstl" reloadable="true"
>useNaming="false">
>
><Resource
>       name="jdbc/mysql"
>
type="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
>       auth="Container"/>
>       <ResourceParams name="jdbc/mysql">
>               <parameter>
>                       <name>factory</name>
>
>
<value>com.mysql.jdbc.jdbc2.optional.MysqlDataSourceFactory</value>
>               </parameter>
>               <parameter>
>                       <name>port</name>
>                       <value>3306</value>
>               </parameter>
>               <parameter>
>                       <name>user</name>
>                       <value>USERNAME</value>
>               </parameter>
>               <parameter>
>                       <name>password</name>
>                       <value>PASSWORD</value>
>               </parameter>
>               <parameter>
>                       <name>serverName</name>
>                       <value>localhost</value>
>               </parameter>
>               <parameter>
>                       <name>databaseName</name>
>                       <value>DATABASE</value>
>               </parameter>
>               <parameter>
>                       <name>explicitUrl</name>
>                       <value>true</value>
>               </parameter>
>               <parameter>
>                       <name>url</name>
>
>
<value>jdbc:mysql://localhost:3306/DATABASE?autoReconnect=true&amp;us
>eUnicode=true&amp;characterEncoding=UTF8&amp;max-connections=50&amp;min
-
>connections=2&amp;inactivity-timeout=30&amp;wait-timeout=30</value>
>               </parameter>
>       </ResourceParams>
></Context>
>
>The info for the above i gleaned from
>http://www.russellbeattie.com/notebook/1006529.html
>
>Then in <web_app>/WEB-INF/web.xml I have
><?xml version="1.0" encoding="ISO-8859-1"?>
><web-app xmlns="http://java.sun.com/xml/ns/j2ee";
>       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>       http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4">
>
>       <resource-ref>
>               <description>DB connection</description>
>               <res-ref-name>jdbc/mysql</res-ref-name>
>               <res-type>javax.sql.DataSource</res-type>
>               <res-auth>Container</res-auth>
>       </resource-ref>
></web-app>
>
>Then in my test JSP I have
>try {
>       Context ctx = new InitialContext();
>       DataSource ds = ( DataSource )
ctx.lookup("java:comp/env/jdbc/MyDS"
>);
>       Connection conn = ds.getConnection();
>...
>
>And the error I get is
>
>javax.servlet.ServletException: Name java:comp is not bound in this
>Context
>
>Which is an error I've managed to hit several times, I know the whole
>connection pooling is the right way to go about this, just surprised at
>how long it is taking me to get going (I dread to think what it will be
>like installing this live with the client, but I'll save that happy
>thought for later)
>
>As ever any help much appreciated... (and if the person who helps me to
>get this working is ever in London I'll stand them a beer or 3)
>
>;-)
>
>TIA
>Dave
>--
>David Smith <[EMAIL PROTECTED]>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to