Installing Apache and Tomcat and Mysql on Windows 7
Installing Apache and Tomcat and Mysql on Windows 7 - Installing JDBC PDF Print E-mail
Written by Administrator   
Sunday, 05 December 2010 15:26
Article Index
Installing Apache and Tomcat and Mysql on Windows 7
Installing Apache on WIndows
Tomcat Windows Install
Install mod_jk on Windows
Setting Up Tomcat Manager
Deploying a GWT app on your Tomcat Server
Installing Mysql on Window 7
Installing JDBC
JDBCHello JDBC Test Project for Eclipse
All Pages

Installing JDBC

So jdbc is in java.sql.* which comes with your jdk.   However, I seem to remember having to put a mysql connector or something in the Java classpath for the Tonido Plug, and I’ll bet I should do the same thing here on Windows.   Here’s what Oracle’s site says about it:

To use the JDBC API with a particular database management system, you need a JDBC technology-based driver to mediate between JDBC technology and the database. Depending on various factors, a driver might be written purely in the Java programming language or in a mixture of the Java programming language and Java Native Interface (JNI) native methods. The JDBC web site maintains a list ofvendors with drivers currently available or under development.

So I googled for ‘mysql jdbc connector’ and landed on the this page, which looks like I can just download a .zip file.

So after unzipping the file, I navigated in one level deep and found the following jar file:

mysql-connector-java-5.1.13-bin.jar

This puppy needs to be in the java CLASSPATH, which is always a nightmare, so I will try to avoid that by simply copying the file to

“C:\program files\Java\jdk1.6.0_18\jre\lib\ext”

Hopefully now all Java programs will be able to find it.
 
No luck so far.  The only way I have been able to run my java program from the command line and have it find the mysql connector is to put the  mysql-connector-java-5.1.13-bin.jar file in the same folder as my class file, and then run with
 
java -cp . JDBCTest
 
I don't understand why setting the CLASSPATH enviornment variable does not work, or even putting in the java/lib/ext folder doesn't work.
Last Updated on Sunday, 05 December 2010 18:27
 

Sponsored Links

Bold Inventions, Powered by Joomla!; Joomla templates by SG web hosting