我想在结果集中附加两个表的数据。我已经尝试了下面的代码,但没有得到想要的输出只有第一个结果集数据,即第一个表数据
ResultSet rs=null;
String sql_query="select * from exception_main;select * from m_roles"
String query1=sql_query.toUpperCase();
String[] results=query1.split(";");
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
CSVWriter writer = new CSVWriter(new FileWriter(csv_file_path + csv_file_name), ',',CSVWriter.NO_QUOTE_CHARACTER);
System.out.println("Count..." + rs.getRow());
writer.writeAll(rs, true);
System.out.println("Count...2::::" + rs.getRow());
writer.close();
while(rs.next()){
rs.deleteRow();
}
System.out.println("Count...3:::::::" + rs1.getRow());
}
}
我在所有三个地方都将计数为 0 请指导我。