aspose file tools*
The moose likes JDBC and the fly likes Problem with DataBase or Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Problem with DataBase or Server" Watch "Problem with DataBase or Server" New topic
Author

Problem with DataBase or Server

sonu arora
Ranch Hand

Joined: Jul 25, 2002
Posts: 30
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.


try & try u ll surely win.
sonu arora
Ranch Hand

Joined: Jul 25, 2002
Posts: 30
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with DataBase or Server