TA的每日心情 | 擦汗 5 小时前 |
---|
签到天数: 527 天 连续签到: 4 天 [LV.9]测试副司令
|
1测试积点
代码是网上找的没怎么看懂,请大神指点
- public class TestJDBC {
- public static Connection getSQLConnection() throws SQLException,java.lang.ClassNotFoundException{
- Class.forName("com.mysql.jdbc.Driver");
- String url = "jdbc:mysql://localhost:3306/learn";
- String userName = "root";
- String password = "123456";
- Connection con = DriverManager.getConnection(url,userName,password);
- return con;
- }
- public static void main(String[] args) {
- try{
- Connection con = getSQLConnection();
- Statement sql = con.createStatement();
复制代码
|
|