Connection connection=DriverManager.getConnection(url);
Statement Statement=conn.createStatement();
conn.close();
上面用connection
下面却用conn肯定错了啊
Statement Statement=connection.createStatement();
connection.close();
书籍,电影,音乐的互动交流平台http://www./
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn=DriverManager.getConnection(url);
catch(ClassNotFoundException ce){
out.print("异常:驱动连接错误");
}
//
try{
Statement st=conn.createStatement();
st.executeUpdate("INSERT into wode(numble,name,xing)values('numble','name')");
out.println("记录插入完毕!");
}
catch((SQLException sqle){
out.print("异常:"+sqle);
}
finally{
try{
if(st!=null) st.close();
if(conn!=null) conn.close();
}catch(Exception e){
out.print("异常:"+e);
}
}