"Unhandled exception type Exception"是什么错误
菜鸟,刚开始学java,修改一个servlet时...
String[][] s2AllTablePara=null;
s2AllTablePara=MyDao.s2getTablePara(para1,para2);
在eclipse中下面这行
s2AllTablePara=MyDao.s2getTablePara(para1,para2);
报错,"Unhandled exception type Exception",是什么原因造成的呢,还望指教
函数的原形是这样的
public static String[][] s2getTablePara(String sWhichTable, String strDS)
throws Exception {
//直接获取参数为要查询的字符串。
String strQuery = "select * from "+sWhichTable;
//WSSysLog.info(strQuery);
String strDataSource = strDS;
//WSSysLog.info(strDS);
//定义要返回的变量
String [][] s2Tmp=null;
Connection con;
Statement stmt;
try {
DataSource ds = getDSContext(strDataSource);
con = ds.getConnection();
con.setReadOnly(true);
stmt = con.createStatement();
} catch (Exception e) {
WSSysLog.printError(e);
con = null;
throw new WSException(e);
}
ResultSet rs = stmt.executeQuery(strQuery);
ResultSetMetaData rsmd = rs.getMetaData();
int count = rsmd.getColumnCount();
while (rs.next()) {
for (int i = 1; i <= count; i++) {
s2Tmp[i-1][0] = rsmd.getColumnName(i);
System.out.println("column name is "+s2Tmp[i-1][0]);
s2Tmp[i-1][1] = rsmd.getColumnClassName(i);
System.out.println("column type is "+s2Tmp[i-1][1]);
}
}
rs.close();
stmt.close();
try {
con.close();
} finally {
con = null;
}
return s2Tmp;
}