|
Subject:
|
JSP 2.0 p484 errata
|
|
Posted By:
|
newtonian
|
Post Date:
|
7/23/2003 10:47:53 AM
|
Hi-
I racked my brains trying to get the sample code to work. Here is what you need to do.
First, add the following line to the code on page 484 of JSP 2.0:
<ResourceParams name ="jdbc/BooksDB">
It goes after the <Resource .../> tag and before the first <parameter> tag.
2nd be sure to put mysql-connector-java-3.0.8-stable-bin.jar in your classpath or in $JAVA_HOME/jre/lib/ext. The authors fail to remind the readers about this one. So be careful.
I changed driverClassName value in server.xml to: com.mysql.jdbc.Driver Check the readme in the mysql-connector-java download for the specifics.
Hope This Helps,
Newtonian
|
|
Reply By:
|
ioda006
|
Reply Date:
|
2/23/2004 3:25:18 AM
|
Ok, I've copied the Wrox Code from the download and I'm pretty sure there's not much that can go wrong in that simple class and jsp anyway and I still can't get this first example to work.
<Context path="/Advanced" docBase="Advanced" debug="5" reloadable="true" crossContext="true"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_Advanced_log." suffix=".txt" timestamp="true"/> <Resource name="jdbc/BooksDB" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/BooksDB"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30000</value> </parameter> <parameter> <name>maxWait</name> <value>100</value> </parameter> <parameter> <name>username</name> <value>bookuser</value> </parameter><parameter> <name>password</name> <value>bookpass</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://localhost:3306/books</value> </parameter> </ResourceParams> </Context> </Host>
</Engine>
</Service>
</Server>
does any of that look wrong?
|
|
Reply By:
|
ioda006
|
Reply Date:
|
2/23/2004 3:27:23 AM
|
I'll also note that I did copy the mysql-connector-java-3.0.11-stable-bin.jar to the G:\j2sdk1.4.2_03\jre\lib\ext directory.
|
|
Reply By:
|
ioda006
|
Reply Date:
|
2/23/2004 9:56:39 PM
|
AHH!! i found the problem.. i had put the mysql connector along with the pooling, collections and dbcp .jar's into the web-inf/lib directory
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/printer/jndi-datasource-examples-howto.html
that page is extremely helpful... id also like to note that the first example is pretty much the exact same thing thats in the wrox book.. hmm =)
|