Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Databases > Don't do DDL wi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 3649 of 3876
Post > Topic >>

Don't do DDL with PreparedStatement with Oracle!

by "joeNOSPAM@[EMAIL PROTECTED] " <joe.weinstein@[EMAIL PROTECTED] > Feb 13, 2008 at 03:14 PM

Hi all.

I found a customer who wanted to repeat the SQL "TRUNCATE TABLE
MY_TABLE",
so they did:

ps = c.prepareStatement("TRUNCATE TABLE THEIR_TABLE");


This statement *worked fine* the first time they executed it, but
fascinatingly,
every subsequent execution of that statement *silently failed, doing
*nothing*!
The driver got the expected response packet from the DBMS, but Oracle
did
nothing. The customer could even continue to execute this statement,
seemingly
successfully, after they completely dropped the table!
   The case was complicated because their code actually created,
executed,
and closed the statement each time, but because the customer was using
a
connection pooling system (like BEA's or Oracle's own JDBC driver),
that will
transparently cache and re-use PreparedStatements (a big performance
feature),
the application would get the same statement under the covers, and
start
getting the odd NO-OP behavior.
  Oracle's driver and our pooling are both unable to do anything about
this,
when the SQL is created at runtime by the customer, and this DBMS bug
would force the non-caching of statements for anyone sending DDL, like
that. To reiterate, this is an Oracle DBMS bug. It can be reproduced
with
a simple JDBC client or an OCI+C program, but not SQL-PLUS because
SQL-PLUS never prepares statements....

FYI,
Joe Weinstein at BEA Systems
 




 6 Posts in Topic:
Don't do DDL with PreparedStatement with Oracle!
"joeNOSPAM@[EMAIL PR  2008-02-13 15:14:44 
Re: Don't do DDL with PreparedStatement with Oracle!
"joeNOSPAM@[EMAIL PR  2008-02-13 15:43:49 
Re: Don't do DDL with PreparedStatement with Oracle!
"kuassi.mensah@[EMAI  2008-02-14 09:02:05 
Re: Don't do DDL with PreparedStatement with Oracle!
"joeNOSPAM@[EMAIL PR  2008-02-14 09:27:35 
Re: Don't do DDL with PreparedStatement with Oracle!
"kuassi.mensah@[EMAI  2008-02-14 11:39:18 
Re: Don't do DDL with PreparedStatement with Oracle!
"joeNOSPAM@[EMAIL PR  2008-02-14 12:01:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 22:09:53 CST 2008.