把PreparedStatement 和ResultSet 声明成private ,最后些个方法:
private void formatThisClass()
{
//释放数据库和文件连接资源
try
{
if (this.mResultSet != null)
{
mResultSet.close();
}
}
catch(Exception er)
{
System.out.println("####Error when release ResultSet!");
}
try
{
if (this.mPreparedStatement != null)
{
mPreparedStatement.close();
}
}
catch(Exception ep)
{
System.out.println("####Error when release PreparedStatement!");
}
try
{
if (this.mConnection != null)
{
mConnection.close();
}
}
catch(Exception ec)
{
System.out.println("####Error when release Connection!");
}
return;
}
关了不成吗?
private void formatThisClass()
{
//释放数据库和文件连接资源
try
{
if (this.mResultSet != null)
{
mResultSet.close();
}
}
catch(Exception er)
{
System.out.println("####Error when release ResultSet!");
}
try
{
if (this.mPreparedStatement != null)
{
mPreparedStatement.close();
}
}
catch(Exception ep)
{
System.out.println("####Error when release PreparedStatement!");
}
try
{
if (this.mConnection != null)
{
mConnection.close();
}
}
catch(Exception ec)
{
System.out.println("####Error when release Connection!");
}
return;
}
关了不成吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货