MyEclipse in Java link mysql.
Unzip the JDBC Jar file first. Configure the environment.
Below I wrote a Java program to load the JDBC driver connection to MySQL code
getconn.javapackage mysql;import java.sql.*;p ublic class getconn { publicconnection conn = null; //Creating connection Objects publicconnection getconnection () { //Get database connection method try { class.forname ("Com.mysql.jdbc.Driver"); //Load Database driver string url = "Jdbc:mysql://localhost:3306/student"; // Specifies the url string user = "root" of the connection database; // Specifies the user name of the database string password = "123"; //password for the specified database conn =drivermanager.getconnection (Url,user,password); if (conn !=null) { //If the connection instance is not empty SYSTEM.OUT.PRINTLN ("Database connection succeeded"); //tip Information } }catch ( Exception e)  {  &NBSp; e.printstacktrace (); } //Exception Handling return conn; //return Connection Object } publicstatic void main (String[]args) { //Program Main Method GetConn Getconn = newgetconn (); //Create Getconn object getconn.getconnection (); }}
The results of the implementation are as follows:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/54/36/wKiom1R8IG2ioaGyAAQVzC2t13w463.jpg "title=" 4n$ UFNX (~8uk~~p4of4r8uy.jpg "alt=" Wkiom1r8ig2ioagyaaqvzc2t13w463.jpg "/>
This article is from the "Wu Xiaocheng" blog, make sure to keep this source http://wuxiaocheng.blog.51cto.com/9555922/1585071
Java link MySQL in MyEclipse