Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with DataBase or Server

 
sonu arora
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
my application (some jsp's and some java classes) is running in IPlanet
i start a thread and its run method has to insert some 50,000 of records into the database. the operation is like this reading of data from xml files and insertion in the database.this is how i proceed ---
first we have a connection pool , i acquire a connection from the pool in the constructor and this connection object is global.
then program starts reading from the xml files one by one and insertion task.
while insertion this is what i m doing...
i have statement object (global) which i create each time and call the query of insertion , then i close the statement each time also.
stmt = conn.createStatement();
stmt.execute(query);
stmt.close();
this way the statement object get created every time for around 50,000 times and one connection object initialized in the constructor(single time).
in finally of run i release the connection.
problem ---------- application behaviour is very much erratic. some times job runs successfully and some times it just hangs in the middle w/o any exception.
some time the table has 50,000 records, some times 98,164,140 and 0 also.
no further insertion if it stops somewhere in the middle.
jdk version is 1.3.1 and server is IPlanet , database is SQLServer 2000.
help me solve this erratic behaviour.
try & try u ll surely win.
 
sonu arora
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
i have addded some print statements.
pw.println("creating statement");
pw.flush();
stmt = conn.createStatement();
pw.println("statement created");
pw.flush();
stmt.execute(query);
pw.println("query executed");
pw.flush();
stmt.close();
pw.println("statement closed");
pw.flush();

to my surprise the job stops after adding 143 records.
and last prints are --
creating statement
statement creat
what shld i guess from this , not the complete print of the string here i have given "statement created"
and processing stops . memory leaks but why it some times not always.
try & try u ll surely win.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic