[+/-]
You can install the Connector/J package using either the binary or
source distribution. The binary distribution provides the easiest
method for installation; the source distribution enables you to
customize your installation further. With either solution, you
must manually add the Connector/J location to your Java
CLASSPATH
.
If you are upgrading from a previous version, read the upgrade information before continuing. See Section 20.3.2.3, “Upgrading from an Older Version”.
Connector/J is also available as part of the Maven project. More information, and the Connector/J JAR files can be found at the Maven repository.
User Comments
On Mac OSX 10.4, simply putting the connector/j in the /System/Library/Java/Extensions folder was not enough for me.
This command:
"Class.forName("com.mysql.jdbc.Driver").newInstance();"
would throw this error:
"Exception in thread "main" java.lang.NoClassDefFoundError: test/class"
After much pain, I set the classpath environment variable manually in the .profile file as follows:
PATH=${PATH}:/usr/local/mysql/bin
CLASSPATH=$CLASSPATH:/System/Library/Java/Extensions/
CLASSPATH=$CLASSPATH:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/:/Library/Java/Extensions/
export CLASSPATH
And all was well.
I had exactly the same problem and was pulling my hair out.
I am running OS X 10.4 on an Intel Mac.
My problem differed slightly in that copying the mysql-connector-java-5.0.3 folder (which is the download file) to the /system/library/java/extensions folder wasn't enough. I had to copy the mysql-connector-java-5.0.3-bin.jar out of the mysql-connector-java-5.0.3 folder and put it in extensions.
For some reason I don't understand it wasn't visible while in its enclosing folder.
I have spent hours trying to get this working but at least it's over now.
I don't think JVM search for all folders and files in the jar directory. It only look through the files in Extension folder.
Add your own comment.