PreparedStatement really preparing ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alain_Kreienbuhl
Posted On:   Tuesday, May 22, 2001 05:43 AM

Hello,

Can someone shed some light on the following aspect of PrepareStatements.

Why is it that : con.prepareStatement("some invalide sql statement");

does not throw any SQLException nor has SQLWarnings if the statement is suposed to be pre-compiled ?

An SQLException is thrown only upon calling ps.executeQuery().

I have tested this with the following configs :
-Oracle 8.0.6/8.1.6 with thin/oci drivers
- DB2 7.1 with app/net drivers
and observed the same behavior.


Thanks.

Alain.

Re: PreparedStatement really preparing ?

Posted By:   Luigi_Viggiano  
Posted On:   Tuesday, May 22, 2001 07:52 AM

Maybe, for some optimization, it prepare the call only the 1st time it's executed and keep it prepared for next calls?

The javadoc says that the SQL is sent to the database only if the driver supports precompilation; and some drivers does not support it (even if I think Oracle and DB2 may do). Hope someone else can help further.
About | Sitemap | Contact