The JDBC drivers is provided through the current Connector/J 5.1. This is a type 4 driver and works for MySQL 4.1, 5.0, 5.1, 5.5. MySQL reference for the driver can be found at http://docs.oracle.com/cd/E19957-01/mysql-refman-6.0/connectors-apis.html#connector-j-versions
Step 1. Ensure JDK 1.6 or 1.7 is already installed.
At the command prompt check the version, see below example where it was installed in C:\Program Files\Java\jre7
> java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b05)
Java HotSpot(TM) Client VM (build 22.1-b02, mixed mode, sharing)
Step 2. Download the driver from Maven2 project.
Download from http://mirrors.ibiblio.org/maven2/mysql/mysql-connector-java/5.1.19/
the file mysql-connector-java-5.1.19.jar
And save to C:\Program Files\Java\jre7\
Step 3. Tell Java where to find the driver
Click on Start ->Control Panel ->System
On the left menu choose, Advanced system setting
Choose Environment variables, in the System variables box click on CLASSPATH and choose Edit.
At the end of the text box, append a semi colon followed by location and the name of the drivers, e.g.
;C:\Program Files\Java\jre7\lib\mysql-connector-java-5.1.19.jar
Choose Ok until all boxes are closed.
If you have any command prompt or Java application, they need to be restarted.
Useful information in order to use the driver;
- The classname: com.mysql.jdbc.Driver
- The connection string: jdbc:mysql://server-name:server-port/database-name
- Username and password to the database
- Default port 3306
OpenOffice / LibreOffice Base
Step 1. Add the classpath
Open Writer and in the menu choose
Tools ->Option ->Java
Click on the JRE installed; Click Classpath ->Add Archive
Choose location of the driver (In this case C:\Program Files\Java\jre7\lib\mysql-connector-java-5.1.19.jar), click OK until all windows are closed.
Step 2. Close all OpenOffice / LibreOffice applications.
Test using the OpenOffice / LibreOffice Base