On 2002-04-18 Marin Dimitrov wrote:
> > It would imply a change in semantics of a PreparedStatement, that it
> > could only be executed one time once the parameters are set. But I
> > wouldn't be surprised if that is what the JDBC spec. says anyway.
> >
>
> doesn't seem so , it says:
>
> "The values set for the parameter markers of a PreparedStatement object are
> not
> reset when it is executed. The method clearParameters can be called to
> explictly
> clear the values that have been set. Setting a parameter with a different
> value will
> replace the previous value with the new one."
>
> ...which IMHO implies multiple executions with the same parameters should be
> possible
This is really strange. I haven't managed to find anything about this
issue anywhere when searching for JDBC.
I now took a quick look at some other JDBC drivers. It seems MySQL's
driver stores streams, but converts them to byte arrays at execution
time. But it would fail on the second attempt to use a stream parameter.
FireBird seems to have a nicer protocol for large objects, but it
doesn't seem to support re-using a stream either.
The JDBC 2.0 Specification has this clarification:
"When an application passes a stream as an input value via a setXXX() or
updateXXX() method, the application is responsible for maintaining the
stream in a readable state until one of the following methods is called:
PreparedStatement.execute(), executeQuery(), executeUpdate(), or
executeBatch(), and ResultSet.insertRow() or updateRow(). A JDBC driver
is not required to wait until one of these methods is called to read the
stream value."
This sort of implies streaming directly, but for a clarification it
doesn't make things much clearer. :)
/Anders
--
A n d e r s B e n g t s s o n | ndrsbngtssn@yahoo.se
Stockholm, Sweden |
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com