java读取数据库中的错误:"Unhandled exception type SQLException"

来源:互联网 发布:淘宝美工是做什么工作 编辑:程序博客网 时间:2024/05/22 00:17
使用rs.next()提示"Unhandled exception type SQLException"


两种解决方法,第一种:try{
while(rs.next())
{


System.out.println("id"+rs.getString(1));
System.out.println("name"+rs.getString(2));
}
}catch(Exception e)
{

}
用try,catch包含
第二种:throws SQLException一下
原创粉丝点击