Re: Don't do DDL with PreparedStatement with Oracle!



On Feb 13, 3:43 pm, "joeNOS...@xxxxxxx" <joe.weinst...@xxxxxxxxx>
wrote:
(I don't know why the original was so badly formatted)
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

It is documented that DDLs should be re-prepared however, I found out
that the OCI driver manages to avoid re-parsing of DDL, throug its
statement cache. The Oracle JDBC team will look into doing the same.

Kuassi
Oracle JDBC product managemenent
http://db360.blogspot.com

.



Relevant Pages

  • Re: Dont do DDL with PreparedStatement with Oracle!
    ... every subsequent execution of that statement ... The driver got the expected ... DBMS bug. ... The Oracle JDBC team will look into doing the same. ...
    (comp.lang.java.databases)
  • Re: Do Not Use FED EX to ship a backglass
    ... I have had numerous issues with Fed Ex, my driver not stopping at my ... I end up having to go to the customer ... The latest one was when I had a Cyclone ramp shipped. ... People who ship and care about their products/customers SHOULD NEVER ...
    (rec.games.pinball)
  • Re: Do Not Use FED EX to ship a backglass
    ... I have had numerous issues with Fed Ex, my driver not stopping at my ... I end up having to go to the customer ... The latest one was when I had a Cyclone ramp shipped. ... People who ship and care about their products/customers SHOULD NEVER ...
    (rec.games.pinball)
  • Re: Do Not Use FED EX to ship a backglass
    ... I have had numerous issues with Fed Ex, my driver not stopping at my ... When I know I am getting a package Fed ... I end up having to go to the customer ... The latest one was when I had a Cyclone ramp shipped. ...
    (rec.games.pinball)
  • Re: OT - supermarket delivery driver dilemma
    ... impression that the customer should go out to the van and help him carry ... generally poor customer service we suffer in this country. ... complain, complain and complain again. ... I always figured that I paid for the driver to turn up within the timeslot ...
    (uk.media.tv.misc)