怎么改呀,多谢!

ty4278 2003-04-08 02:52:11

try{
................

}
catch(Exception e){
return 1;
}
finally{
if (iCallableStatement!=null) {iCallableStatement.close();}
if (iConnection!=null){iConnection.close();}
}
怎么老是报错?????
怎么改呀,多谢!
"login.java": Error #: 360 : unreported exception: java.sql.SQLException; must be caught or declared to be thrown at line 42, column 37
"login.java": Error #: 360 : unreported exception: java.sql.SQLException; must be caught or declared to be thrown at line 43, column 38
...全文
39 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
remanwang 2003-04-08
  • 打赏
  • 举报
回复
try{
................

}
catch(Exception e){
// return 1;
}
finally{
if (iCallableStatement!=null) {iCallableStatement.close();}
if (iConnection!=null){iConnection.close();}
}
moumouren 2003-04-08
  • 打赏
  • 举报
回复
try{
................

}
catch(Exception e){
return 1;
}
finally{
try{
if (iCallableStatement!=null) {iCallableStatement.close();}
if (iConnection!=null){iConnection.close();}
}catch(SQLException e){
return 1;
}
}
dybine 2003-04-08
  • 打赏
  • 举报
回复
if (iCallableStatement!=null) {iCallableStatement.close();}

if (iConnection!=null){iConnection.close();}

会抛出SQL异常,你必须捕获它try catch
takecare 2003-04-08
  • 打赏
  • 举报
回复
有数据库操作的地方都放到try{}catch(){}中。

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧