String driver ="sun.jdbc.odbc.JdbcOdbcDriver";
String url ="jdbc:odbc:jsp";
String user ="";
String password ="";
try
{
Class.forName(driver);
out.println("open success1");
}
catch(Exception e)
{
out.println("can't open driver:"+driver);
e.printStackTrace();
}
try
{
String text ="aab";
Connection con =DriverManager.getConnection(url,user,password);
Statement smt =con.createStatement();
smt.executeUpdate("INSERT into table1 (id,name) VALUES('"+text+"','"+text+"')");
smt.close();
con.close();
out.println("open success2");
}
catch(SQLException se)
{
se.printStackTrace();
out.println("open error2");
}
String url ="jdbc:odbc:jsp";
String user ="";
String password ="";
try
{
Class.forName(driver);
out.println("open success1");
}
catch(Exception e)
{
out.println("can't open driver:"+driver);
e.printStackTrace();
}
try
{
String text ="aab";
Connection con =DriverManager.getConnection(url,user,password);
Statement smt =con.createStatement();
smt.executeUpdate("INSERT into table1 (id,name) VALUES('"+text+"','"+text+"')");
smt.close();
con.close();
out.println("open success2");
}
catch(SQLException se)
{
se.printStackTrace();
out.println("open error2");
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货