I have a text file from where i read values
FileInputStream file = new FileInputStream("C:/workspace/table_export.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(file));
String line = null;
while( (line = br.readLine())!= null )
{
String [] tokens = line.split("\\s+");
String var_1 = tokens[0];
System.out.println(var_1);
getstaffinfo(var_1,connection);
}
The values read from text file is passed to getstaffinfo method to query the db
public static String getstaffinfo(String var_1, Connection connection) throws SQLException, Exception
// Create a statement
{
StringBuffer query = new StringBuffer();
ResultSet rs = null;
String record = null;
Statement stmt = connection.createStatement();
query.delete(0, query.length());
query.append("select firstname, middlename, lastname from users where employeeid = '"+var_1+"'");
rs = stmt.executeQuery(query.toString());
while(rs.next())
{
record = rs.getString(1) + " " +
rs.getString(2) + " " +
rs.getString(3);
System.out.println(record);
}
return record;
}
I get almost 14000 values read from text file which is passed to getstaffinfo method, all database activities such has loading driver, establishing connectivity all works fine. But while printing
it throws error
java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded
Although i understand that this error is to do with database configuration, Is there an efficent way of making one db call and exceute the query for multiple values read from text file. Any inputs would be of great use.
Many Thanks in advance!!