2015-06-08|1279阅|作者:Essence|举报 摘要:package cn.edu.;
import java.sql.*;
public class JDBCTest{
public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver
package cn.edu.;
import java.sql.*;
public class JDBCTest{
public static void main(String[] args){
try{
Class.forName("com.mysql.jdbc.Driver");
String url="jdbc:mysql://127.0.0.1/JJUDB?"
+"&useUnicode=true&characterEncoding=GB2312";
String user="root";
String pass="111111";
Connection conn=DriverManager.getConnection(url,user,pass);
conn.close();
System.out.println("连接数据库成功.");
}catch (Exception e){
e.printStackTrace();
}
}
}