looks like you are using the 5.0 docs rather than 5.5 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html
<Context ...> ... <Resource name="jdbc/EmployeeDB" auth="Container" type="javax.sql.DataSource" username="dbusername" password="dbpassword" driverClassName="org.hsql.jdbcDriver" url="jdbc:HypersonicSQL:database" maxActive="8" maxIdle="4"/> ... </Context> Allistair > -----Original Message----- > From: Nat Titman [mailto:[EMAIL PROTECTED] > Sent: 27 October 2004 12:22 > To: [EMAIL PROTECTED] > Subject: Database connection pooling > > > Hi, > > I'm attempting to integrate database connection pooling into an > exisiting JSP-based web application. > > I'm running Tomcat 5.5.2 Server, with J2SE 1.5.0 and a MySQL database > (version 11.18) accessed through the com.mysql.jdbc package. > > I've followed MySQL instructions from this page: > > http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasourc > e-examples-howto.html > > I made the changes to server.xml and the web app's web.xml, changing > variables to match the database name, user name and password of the > correct database. I ensured the MySQL package was in common/lib/. > > My DAO objects now have constructors of the following form, which was > adapted from code found online ('broadband' is the database name): > > private Connection myConn; > private DataSource dataSource; > > /** > * Constructs the data accessor using the connection pool > * > * @exception SQLException thrown for SQL errors > */ > public SearchDAO() throws SQLException { > > try { > > // retrieve datasource > Context init = new InitialContext(); > Context ctx = (Context) init.lookup("java:comp/env"); > dataSource = (DataSource) ctx.lookup("jdbc/broadband"); > > // get connection > synchronized (dataSource) { > > myConn = dataSource.getConnection(); > > } > > } catch (NamingException ex) { > > System.err.println( > "new SearchDAO: Cannot retrieve > java:comp/env/jdbc/broadband: " > + ex); > > } catch (SQLException excep) { > > System.err.println( > "new SearchDAO: Could not get connection: " + excep); > > } catch (Exception e) { > > System.err.println("new SearchDAO: " + e); > > // System.out.println ("In the catch block : ...."); > //e.printStackTrace(); > > } > > } > > The constructor throws the following exception: > > org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC > driver of class '' for connect URL 'null' > > The connect URL is present in server.xml and is correct for > the database. > > My only guess at this point is that the howto document above asks for > the Context tag to be added to server.xml between the example close > Context and the first open Host tag, however there wasn't an example > Context tag in server.xml and there appears to be a > context.xml file in > the same directory. I'm wondering if Contexts have moved to a > different > file in a recent version of Tomcat? It's just a wild guess > (and I've no > idea how to add the Context to context.xml as there's already > a Context > tag in there and no higher level tag around it). > > Any help would be greatly appreciated. Sorry if I'm wasting your time > with an obvious or frequently asked question, I've googled and read > quite a few documents, but I think I'm just at the 'stabbing in the > dark' point and could do with guru guidance. > > Thanks, > > > Nat. > > -- > Nat Titman > Developer > > MitchellConnerSearson > 3-5 High Pavement > The Lace Market > Nottingham NG1 1HF > Tel +44 (0)115 959 6455 > Fax +44 (0)115 959 6456 > Direct +44 (0)115 959 6462 > www.choosemcs.co.uk > > Confidentiality: This e-mail and its attachments are intended > for the above named only and may be confidential. If they have > come to you in error you must take no action based on them, > nor must you copy or show them to anyone; please reply to this > e-mail and highlight the error. > > Security Warning: Please note that this e-mail has been > created in the knowledge that Internet e-mail is not a 100% > secure communications medium. We advise that you understand > and observe this lack of security when e-mailing us. > > Viruses: Although we have taken steps to ensure that this > e-mail and attachments are free from any virus, we advise that > in keeping with good computing practice the recipient should > ensure they are actually virus free. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> ------------------------------------------------------- QAS Ltd. Developers of QuickAddress Software <a href="http://www.qas.com">www.qas.com</a> Registered in England: No 2582055 Registered in Australia: No 082 851 474 ------------------------------------------------------- </FONT> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]