Hello,
the JDBC-specification says that the batch mode should used only for
commands which returns a result count. If one of the batch commands creates
a resultset the JDBC-driver must throw an SQLException. Until now SAPDB's
JDBC-driver allow commands in batch mode which create resultsets. But the
next version of the driver will throw an SQLException to be conform to the
JDBC-specification. So, I think you should not use SELECT within batch mode.


But the reason for the ClassCastException is not the batch mode. You should
also get the exception if you try to execute the SELECT as single command.
It seems that you try to set a string value for a parameter of type byte[].
There is no clever conversion from string to byte[] and so i think it's okay
that an exception will be thrown. But, I agree with you that the exception
should be an SQLException (or InvalidArgumentValue) and not a
ClassCastException.   

If your SELECT command doesn't work as single command and you don't try to
convert string values to byte arrays, you should send me a JDBC-trace
(http://sapdb.2scale.net/moin.cgi/JdbcTrace) or better a small testprogram
that reproduce the error.

Regards,
Marco
----------------------------------------------
Marco PASKAMP
SAP DB, SAP Labs Berlin

-----Original Message-----
From: Raimund Jacob [mailto:[EMAIL PROTECTED]]
Sent: Samstag, 16. M�rz 2002 01:41
To: SAPDB General list
Subject: JDBC: SELECT in batch mode


hi *,

i am trying to select multiple rows given the primary keys (or parts of
that). i was told (on that list, several months ago) that i could use
SELECT in batch mode (prepareStatement(), setXXX(), addBatch() and
exute[Query]()). Unfortunately the ResultSet does not contain the union
of the individual result sets but only the last one. is this a bug? is
it supposed to be that way?

on a perhaps related note: i think there is a bug in the jdbc driver:

com.sap.dbtech.jdbc.translators.BinaryDataTranslator.putSpecific(BinaryDataT
ranslator.java:45)

contains a cast from some Object into a byte[]. When i try to do
batch-SELECTs this results in a ClassCastException because the object is
actually a java.lang.String.

so: either this particular translator is not used correctly in some
cases or batch-selects are not allowed. if this is the case some good
exception should be thrown.

thanks for any advice,
        Raimund

-- 
Raimund Jacob
                                                 \|/ ____ \|/
Pinuts Media+Science GmbH                        "@'/ ,. \`@"
Potsdamer Str. 96                                /_| \__/ |_\
D-10785 Berlin                                      \__U_/
http://www.pinuts.de/ voice: +49 30 590090313 fax: +49 30 590090390
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to