import org.junit.Test;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Properties;
public class Test1 {
@Test
public void test() throws SQLException {
Driver driver = new com.mysql.jdbc.Driver();
//jdbd:mysql: 协议
//localhost: IP地址
//3306 默认的mysql端口号
//test test数据库
String url = "jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8";
//将用户名和密码封装在Properties中
Properties info = new Properties();
info.setProperty("user","你的用户名");
info.setProperty("password","你的密码");
Connection connection = driver.connect(url,info);
System.out.println(connection);
}
}



