1. 程式人生 > >MYSQL的JDBC驅動下載及安裝

MYSQL的JDBC驅動下載及安裝

1、下載mysql for jdbc driver.
   http://dev.mysql.com/downloads/connector/j/3.1.html
MySQL Connector/J is distributed as a .zip or .tar.gz archive containing 
the sources and class files as well as a class-file only "binary" .jar 
archive named "mysql-connector-java-3.1.10-bin.jar".

2、解壓縮下載的檔案,如:mysql-connector-java-3.1.10.zip

You will need to use the appropriate gui or command-line utility to un-archive 
the distribution (for example, WinZip for the .zip archive, and "tar" for 
the .tar.gz archive).

3、mysql for jdbc driver有兩種安裝髮式:

Once you have un-archived the distribution archive,
you can install the driver in one of two ways:

  第一種方法:將com和org兩個目錄下所有檔案和目錄拷貝到任何地方,比如將com和org兩個目錄下所有檔案和目錄拷貝到任何地方,比如d:/mysqlforjdbc下
            設定classpath=.;d:/mysqlforjdbc;%classpath%

Either copy the "com" and "org" subdirectories and all of their contents
to anywhere you like, and put the directory holding the "com" and "org"
subdirectories in your classpath, or...

  第二種方法:將mysql-connector-java-3.1.10-bin.jar拷貝到一個地方,如:D:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib下
            設定classpath=.;D:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/mysql-connector-java-3.1.10-bin.jar;%classpath%

     或直接把mysql-connector-java-3.1.10-bin.jar拷貝到%JAVA_HOME%/jre/lib/ext下
     %JAVA_HOME%就是J2SDK的安裝目錄,如我的為D:/j2sdk1.4.2_06就拷貝到D:/j2sdk1.4.2_06/jre/lib/ext下

(除錯java程式使用)

Put mysql-connector-java-3.1.10-bin.jar in your classpath, either by adding the 
FULL path to it to your CLASSPATH enviornment variable, or putting it
in $JAVA_HOME/jre/lib/ext.