part of modified server.xml:
I created a database called bird with MySQL, and the jsp file is placed in the folder webapps/jbird/, the Connect.class, web.xml and server.xml all sit at their right places. All necessary jar files(commons-dbcp-1.2.1.jar, commons-collections-3.1.jar ....) are correctly placed. And I not only tried rebooting the tomcat but also rebooted my laptop....but, miserably enough, always no connection and the information in the log file is:
INFO: Server startup in 4640 ms
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
... 22 more
I've wasted way too much time on this issue, any suggestion or explaination would be greatly appreciated! Thank you very much in advance.
If that fails and no one with greater experience than I pops up to help then I suggest that you work through the Tomcat example app provided with DBCP (I assume there is one) and see if you can get that working. Then look at the differences between the two.
However, the stack trace suggests that the mysql driver classes are not in the classpath (Caused by: java.sql.SQLException: No suitable driver).
We use classes12.zip for oracle, i think its mysqlxxxx.jar for mysql. Check if the jar is present, if not, you can place the jar in shared/lib so that it can be used by all web applications.
Julian was right, apache has documentation on DataSource Configuration
The documentation talks about using a new driver "com.mysql.jdbc.Driver"
Hope this helps.
[ September 12, 2004: Message edited by: Sheldon Fernandes ]
The parameters configured were thus not linked to the <Resource name="jdbc/CellphoneDB" ... />
That's why the error:
Cannot create JDBC driver of class '' for connect URL 'null'
I tried your treatment but it didn't work out. I found a better example here and I've given up this approach, and restored the original server.xml file. But still I'm eager to know why the code above always generated the same exceptions.
I'll be greatly obliged for any enlightenment.
My previous answer was based on the Tomcat documentation for version 4.1 (this is what I use, sorry for not noticing the version you are using). I just had a look at the documentation for version 5.5 and it appears they have changed the server.xml structure. <ResourceParams> is no longer present. They have made all the configuration parameters as attributes of the <Resource> tag.
Have a look at the DataSource Configuration for Tomcat 5.5.
I hope this resolves your problem.
About the other approach, I have never used or seen that being done before. The conventional thing to do is to create DataSources (provided by application server) and perform a jndi lookup to get a reference to them.