statement.close();关闭连接的游标

This commit is contained in:
chenlw 2017-02-19 11:27:46 +08:00
parent 7bcc95e0d4
commit 43e3e7c80c
1 changed files with 16 additions and 0 deletions

View File

@ -72,6 +72,12 @@ public class OracleConnector {
}
}
/** 不要使用这个方法 statement没法关闭
* @param conn
* @param sql
* @param filePath
* @return
*/
public synchronized static ResultSet getSQLExecResultSet(Connection conn,
String sql, String filePath) {
ResultSet resultSet = null;
@ -105,6 +111,14 @@ public class OracleConnector {
return resultSet;
}
/** 不要使用这个方法 statement没法关闭
* @param url
* @param user
* @param password
* @param sql
* @param filePath
* @return
*/
public synchronized static ResultSet getSQLExecResultSet(String url,
String user, String password, String sql, String filePath) {
ResultSet result = null;
@ -138,6 +152,7 @@ public class OracleConnector {
flag = true;
FileOperateHelper.fileWrite(filePath + ".log", "执行结果:" + res
+ " \r\n");
statement.close();
} catch (SQLException e) {
flag = false;
FileOperateHelper.fileWrite(filePath + ".log",
@ -169,6 +184,7 @@ public class OracleConnector {
flag = true;
FileOperateHelper.fileWrite(filePath + ".log", "执行结果:"+ res
+ " \r\n");
statement.close();
} catch (SQLException e) {
flag = false;