时间:2021-07-01 10:21:17 帮助过:66人阅读
Class.forName("com.mysql.jdbc.Driver"); ct=DriverManager.getConnection("jdbc:mysql://localhost:3306/test1","root","wenhao"); sm=ct.createStatement(); rs=sm.executeQuery("select *from test"); try { ps=ct.prepareStatement("insert test values(14,'aaa')"); System.out.print("插入成功"); } catch (Exception e) { // TODO Auto-generated catch block System.out.print("插入失败"); }