eclipse如何连mysql

eclipse怎么连mysql
如题

------解决方案--------------------
下载 连接mysql的jar 包,如:mysql-connector-java-5.0.4-bin.jar
把jar包加入到你的项目中.
以下是连接代码

try {
// Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Success loading MySQL Driver...");
} catch (Exception ex) {
System.out.println("Error loading MySQL Driver...");
ex.printStackTrace();
}
try {
conn = DriverManager
.getConnection("jdbc:mysql://localhost:3306/数据库名?user=root&password=密码");
System.out.println("Success connect Mysql Database!"); 
} catch (Exception e) {
e.printStackTrace();
}