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");
}

解决方案 »

  1.   

    看书,自己再编写一个就可以了,很多书上都有的!
      

  2.   

    其实理论和实际是有很大区别的,我是今年7月毕业的,刚毕业的时候以为什幺都会,可是到了公司一做项目才知道什幺都不会,所以要多实践,从小到大的做,这样才能成长.至于数据库方面的编程其实是一个项目中技术含量高而容易实现的一部分.它有点套模式的样子,只要做过一个项目就知道数据库其实很简单.