I have an existing mysql install set up for php dev that I am trying to access with JSP. Server is "localhost" with db name "fame" user is "root" with pass "test" I have added localhost.localdomain to my hosts file The code I am using is:
The db fields are from my db instead of the test. At first I was getting an error about not finding the driver for the connection. After a few hours on the net I found a mysql-connector-java.jar from the mysql site that I put in my WEB-INF/lib folder. Now I am getting a different error.
I cannot seem to figure out why I can't get this to work and my goodness this is getting frustrating. I was stuck for a while because te jstl library files from the book have different taglib lines and now the mysql driver from jstl just won't work without all this extra hunting around. I am wondering does this much change in JSP in a year? Thanks for the help.
Hmm. The error you're seeing is usually due to one of two things: 1) the database URL is incorrectly formed and doesn't match what is expected by the Driver. Yours looks fine. 2) the Driver was loaded but was not the one you expected - unlikely, but it's been done before. Yours looks fine. A quick web search shows that one user solved the problem by moving to Tomcat 5. Does this help?
Another thought occurred to me, try using "org.gjt.mm.mysql.Driver" as the Driver instead. I'm not sure why, but it might depend on the version of the Drivers you're using. Dave
Joined: Mar 02, 2004
I saw that thread as well, but I am already using Tomcat 5. I tried the other driver version, but that didn't help either. If I use that driver do I need to include the file for that driver like the taglib lines for the jstl files?
seems to me that the JSP cannot find the jar file of the JDBC driver from the classpath, did you check whether you have put the jar file to: $CATALINA_HOME/APP_NAME/WEB-INF/lib ? or, does the jar file correct? In fact, you may try the newer jdbc driver, I forget the exact name, it seems be somewhat like... J/Connector version 3.x, right? Nick.