Class.forName("com.mysql.jdbc.driver"); //加载驱动
String url = "jdbc:mysql://localhost:3306/test";
String username = "root";
String password = "root";
Connection conn = DriverManager.getConnection(url,username,password); //建立连接
PrepareStatement ps = conn.prepareStatement(sql);
时间: 2024-10-20 02:08:41