Starting point of setBinaryStream(long pos) on java.sql.Blob?
Anybody knows what I exactly have to put insetBinaryStream(long pos) method ofjava.sql.Blob?
I mean.. 0L, 1L or any?
Here comes oracle jdbc doc
--
public java.io.OutputStream getBinaryOutputStream() throws java.sql.SQLExceptionDeprecated.
This method is deprecated. UsesetBinaryStream(0L).
And here coms another code samples in oracle documents
(http://download-west.oracle.com/docs/cd/B19306_01/java.102/b14355/oralob.htm#CHDFHHHG)
--
File binaryFile =new File("john.gif");
System.out.println("john.gif length = " + binaryFile.length());
FileInputStream instream =new FileInputStream(binaryFile);
OutputStream outstream = blob.setBinaryStream(1);
[883 byte] By [
ticanoa] at [2007-10-2 17:50:59]

Thanks lancea.
My instant test results that both number (0L and 1L) looks ok.
And this is what makes me crazy. (I think I'm a little bit prefer to be cleared for every :))
So. do I have to put 1L? for suer?
I found that it's explicitly 1 for OCI. (from documents)
This should be documented with SO THAT IT IS VERY CLEAR FOR EVERYONE USING THE API, as it breaks the general Java contract of indexing starting from 0 and specifically the streaming contract used by java.io/java.nio classes.
So there is a semantic clash here (which in itself is a different point of argument), which I think needs to be clearly pointed out.
BR,
Joni
Given the confusing nature of parameters to setBinaryStream(long), especially the fact that that the parameter should be 1L and not 0L (as expected) , could I humbly suggest that getBinaryOutputStream is retained without deprecation. The Oracle's driver code redirecting the call to setBinaryStream(long) with the correct safe value for 'long'.
This would also allow us to work with various drivers and databases between 8.0 and 10G without either recompiling code or receiving deprecation messages.