R
Rizwan
Hi,
I have written a java program (an EJB) which reads a file (row by row) and
updates some tables based on certain criteria. The program works ok until
the files has 6000 runs. Then the program is failing and giving an error
message :
2004-12-13 15:27:30,101 ERROR [org.jboss.ejb.plugins.LogInterceptor]
Unexpected Error:
java.lang.OutOfMemoryError
I find out where exactly it is failing but dont know how to fix it. My
program read the first row then based on some rules it generates a SQL
statement for this row in a string. I then add it to the batch using
addBatch method of Statement. When I finish reading the file I executes the
batch using executeBatch metohd of Statement. Thats where it is failing. Any
reason? Thanks
Statement stmt = cx.createStatement();
FileReader fr = new FileReader( file );
BufferedReader br = new BufferedReader( fr );
String lineData = null;
String insertStatementSQL = "";
while ( (lineData = br.readLine()) != null ) {
....
stmt.addBatch(insertStatementSQL);
}
int returnValueIntArray[] = stmt.executeBatch();
I have written a java program (an EJB) which reads a file (row by row) and
updates some tables based on certain criteria. The program works ok until
the files has 6000 runs. Then the program is failing and giving an error
message :
2004-12-13 15:27:30,101 ERROR [org.jboss.ejb.plugins.LogInterceptor]
Unexpected Error:
java.lang.OutOfMemoryError
I find out where exactly it is failing but dont know how to fix it. My
program read the first row then based on some rules it generates a SQL
statement for this row in a string. I then add it to the batch using
addBatch method of Statement. When I finish reading the file I executes the
batch using executeBatch metohd of Statement. Thats where it is failing. Any
reason? Thanks
Statement stmt = cx.createStatement();
FileReader fr = new FileReader( file );
BufferedReader br = new BufferedReader( fr );
String lineData = null;
String insertStatementSQL = "";
while ( (lineData = br.readLine()) != null ) {
....
stmt.addBatch(insertStatementSQL);
}
int returnValueIntArray[] = stmt.executeBatch();