|
这样的几行东东
-
- Class.forName("org.gjt.mm.mysql.Driver");
- Connection con = DriverManager.getConnection("jdbc:mysql://localhost/java?user=gray&password=111111");
- Statement smt = con.createStatement();
- ResultSet rs = smt.executeQuery("select * from phonebook");
复制代码
如果些在jsp页面中没有问题,但是写道Bean里的时候,编译出现这样的错误:
- link.java:17: unreported exception java.sql.SQLException; must be caught or dec lared to be thrown
- Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/java?user=gray&password=111111");
复制代码
加上出错处理才好用,我一直以为出错处理是个人行为,不想用就不用,为什么是这样的? |
|