當我的結果集數據量較大,我得到 com.ibm.db2.jcc.am.SqlException: [jcc][t4][10120][10898][4.9.78] Invalid operation: result set is closed. ERRORCODE=-4470, SQLSTATE=null
例外,但是當我儘量不與結果集無效操作:結果集關閉
下面的數據量較少是我的代碼片段
ResultSet rs=null;
String sql_query="select * from exception_main;select * from m_roles"
String query1=sql_query.toUpperCase();
String[] results=query1.split(";");
CSVWriter writer = new CSVWriter(new FileWriter(csv_file_path + csv_file_name), ',',CSVWriter.NO_QUOTE_CHARACTER);
for(int i=0;i<results.length;i++)
{
if(results[i].startsWith("SELECT"))
{
System.out.println("Inside select"+ results[i]);
ps = conn1.prepareStatement(results[i].toString());
rs = ps.executeQuery();
...
//writing to csv file
System.out.println("Count..." + rs.getRow());
writer.writeAll(rs, true);
while(rs.next()){
rs.deleteRow();
}
System.out.println("Count...3:::::::" + rs1.getRow());
}
}
writer.close();
rs.close();