How to configure MySQL JDBC driver mysql-connector-java-5.1.12?

I downloaded the MySQL JDBC driver from http://www.mysql.com/downloads/connector/j/ . How to configure it?

+5
source share
3 answers

Essentially, you just need to put it in the path to the program runtime, and then load it like this:

try {
    Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
    throw new RuntimeException("Cannot find the driver in the classpath!", e);
}

If you are using an IDE, you need to add the library to the Build Path project. If you use it with java.exe, you need to specify the full path to the JAR file of the JDBC driver in the argument -cp, for example. (Windows targeting):

java -cp .;/path/to/mysql-connector-java-5.1.12.jar com.example.YourClass

MySQL + JDBC.

. Flex, , , Flex. , Flex , Java + . HTTP . Java- (Servlet? Webservice?), /pathinfo, HTTP-, . HTTP- Flex HTTP-.

+6

: https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-installing.html. . ..: [PATH_TO_JAVA]/jre/lib/ext/ ( Win Mashine) /Library/Java/Extensions (Mac OS X) ..

+3

All Articles