One months ago, there were a lot of problems when I did the work, and we solved them all. After it is done, it is time to re-do the work on another computer, or to meet some of the same problems, and solve them. Fortunately the time is not long, vaguely remember how to solve. Good memory is better than bad writing, or write down, in case you encounter similar work to do later.
Next I will write in the form of a point, so easy to read a little.
1, install Java, Eclipse, Mysql, how to install the Internet has, do not repeat.
2, download Java connection MySQL jar package, I am from the official website Mysql-connector-java-5.1.45-bin.jar, but need to log in, other places also have can download.
3, import the jar package, first select the appropriate project, then click the menu bar Project->properties->java Bulid path->libraries->add External JARs, Find the jar package you downloaded, select it, click Apply and close on the right.
4. Load Driver
There are two methods, one of which is import
Import com.mysql.jdbc.Connection;
The other is to call the Class.forName () method in the function to load the driver
Class.forName ("com.mysql.jdbc.Driver");
5. Establish the connection
Java Connection MySQL Database