1 message in com.mysql.lists.javaRe: MySQL Pools, DataSources, etc. N...
FromSent OnAttachments
root04 Apr 2002 05:37 
Subject:Re: MySQL Pools, DataSources, etc. Need definitive information.
From:root (joh@meagher.cncdsl.com)
Date:04/04/2002 05:37:47 AM
List:com.mysql.lists.java

I'm new to Java and even newer to DataSources and ConnectionPooling. I'm having a time getting Tomcat's JNDI DataSource to use the mm driver.

I followed the instructions for jakarta's jndi-resources-howto, using the following parameters, which work fine explicitly stated inside a JSP.

I replaced what I thought I should in the web.xml as follows: user = username password = something driverClassName = org.gjt.mm.mysql.Driver driverName = jdbc:mysql:127.0.0.1/mydb

Error in my JSP occurs on... Connection myConn = ds.getConnection(); Error: java.lang.NullPointerException at

org.apache.jsp.character_0002ddatasource_0002d2$jsp._jspService(character_0002ddatasource_0002d2$jsp.java:71)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) Commenting out the line containg get.Connection() results in no errors. The earlier Context statements are ok.

Will the mm driver work as a replacement to the Tyrex Driver? If so, what could be wrong?

I'm confused over the differing implementations of connection pooling and DataSource. 1. The jndi-resources-howto implies that both connection pooling and DataSource are implemented with their example. I looked at the java files for mm/jdbc2 and everything seems to be there for doing this. The driver.class seems to test for the more advanced features. 2. Although I could use several examples to 'roll my own', none of them use the pooling class files for the driver, but rather, build their own connectionpool and hashtable. Why wouldn't they simply implement what's in org.gjt.mm? 3. Additionally, Tomcat 4.0 offers, as well, Struts as a way to implement both the dataSource and connectionPool. 4. The mm Driver files point to using the driver's capabilities locally within a webapp.

How can I use Tomcat for providing the DataSource and ConnectionPool using the mm driver? What am I missing? Thanks in advance for your help!

--John