当前位置: 技术问答>java相关
Servlet & Jdbc 的问题
来源: 互联网 发布时间:2015-04-06
本文导语: Servlet中加加载JDBC的时候: Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 报错: D:j2sdk1.4jsdk2.1srctestDemoTable.java:18: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown Class.forName("sun.jdbc.odbc.JdbcO...
Servlet中加加载JDBC的时候:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
报错:
D:j2sdk1.4jsdk2.1srctestDemoTable.java:18: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
什么原因呀?
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
报错:
D:j2sdk1.4jsdk2.1srctestDemoTable.java:18: unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
什么原因呀?
|
use try { } and catch { } to catch the exception.
|
you must use try{}&catch(){}to include your paragraph in,the exception information just tell you to do this,for examples,when you make some "rmi" programs,you must use "catch Remote exception"to catch the exceptio where you call the rmi interface!
|
java.sql.*里面的类文件,使用它里面的方法,一般都会抛出SQLException异常错误,你必须对其进行捕获,才能运行
|
要用TRY,CATCH呀!