This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm working on a project that involves a web client connecting to a fairly small MySQL database that holds the results of surveys. While I'm fairly experienced with Java, I haven't worked with JDBC too much, and I'd like some guidance on an exception I'm getting.
First off, the setup: 1) MySQL 5.0 running on an OSX dual-G5 server. 2) Sun Application Server 9.1 running locally on my computer. 3) Java 5 EE configured with Eclipse 3.3 JDK 184.108.40.206 JRE 220.127.116.11
The problem I'm running into occurs when my program tries to connect to the MySQL database. Heres the relevant code:
and here's the trace log of the exception:
The relevant part of that is the "Database driver not found" part; the null pointer is thrown because the rest of my class tries to use the connection that's obviously not being created correctly.
I know it's possible to get the connection working, as I can connect to the database using the Database Development plugin that came with Eclipse.
Can anyone here walk me through where to paste/stick the Connector/J jar to give my application access? Preferably somewhere inside my actual application's file system to simplify the migration over to an actual server.
If you are planning to rely upon container-managed connection pooling (a best practice), the jar file with the driver must be placed where it will be in the classpath of the container as well as the web apps that will use it.