Re: executeUpdate takes forever





rouble@xxxxxxxxx wrote:

Hi Joe,

Thanks for the response. Please read inline.


rouble@xxxxxxxxx wrote:


Hi All,

If I do the following:

           String cmd = "INSERT INTO Orders(Id, CompilationTitle,
Template, PurchaseDate, RecievedPayment, CompilationDate, TotalCost,
TotalLength, Customer_Id) VALUES(Orders_sequence.nextval, ";

           cmd += "'" + cl.getOptionValue("title") + "', '" +
cl.getOptionValue("template") + "', NULL, 'N', SYSDATE, 0.00, 0, " +
cl.getOptionValue("customerId") + ")";

           // run the command
           System.out.println(cmd);
           stmt.executeUpdate(cmd);

... it takes forever (over 10 minutes). Is there anyway I can debug
this to see what is going on ?

If I run the exact same command on the SQL prompt it takes it
*instantaneously*. Am I missing something ?

Cheers
rouble

Just show us the actual final string you're sending.


Here is the string:
"INSERT INTO Orders(Id, CompilationTitle, Template, PurchaseDate,
RecievedPayment, CompilationDate, TotalCost, TotalLength, Customer_Id)
VALUES(Orders_sequence.nextval, 'Best of BEP', 'Flying Notes', NULL,
'N', SYSDATE, 0.00, 0, 1)"


I assume the time is all taken in the executeUpdate() call.


Yes, as far as I can tell.


The way to debug it is to set the oracle session to print out the query plan. Then compare the
query plan for the SQL-PLUS session to the JDBC one.


How do I do this ? I am new to the db arena.

You're going to have to ask for help from your DBA. As far as I know, the query plans are printed out at the DBMS. Joe



Is the JDBC client running from the same machine as the SQL-PLUS
client?


Yes.


Which JDBC driver are you using?


I tried:

oracle.jdbc.OracleDriver and
oracle.jdbc.driver.OracleDriver

Cheers
rouble


Joe Weinstein at BEA Systems



.