milesibastos / jTDS

jTDS JDBC Driver
http://jtds.sourceforge.net/
GNU Lesser General Public License v2.1
81 stars 46 forks source link

FIX #703 No support for setBinaryStream(int,IS,long) #9

Closed alekseysotnikov closed 7 years ago

alekseysotnikov commented 7 years ago

Original ticket - https://sourceforge.net/p/jtds/bugs/703/

Hibernate 4.1.12 is using setBinaryStream(int,InputStream,long) insteat of setBinaryStream(int,InputStream,int) in order to specify the length of a blob. This does not work with jTDS, as it throws an AbstractMEthodError(). The JDBC4 method sould be implemented, eighter by forwarding to the old method of the size fits into an int, or by generally forwarding the long value, if this can be done easily.

I took a patch of Martin Ball to make that fix, from here https://sourceforge.net/p/jtds/bugs/703/#7c8c :

I have created a patch for 1.3.1 which forwards the method calls on to the methods which accept the int length. I have reused the same error messages which are used by setBlob(int parameterIndex, Blob x) and setClob(int parameterIndex, Clob x) when the length of the data is > Integer.MAX_VALUE. We have only checked that the change for setBinaryStream(int,InputStream,long) is working on our system, not the clob changes. I regret to say that I have not looked at the unit tests as at the moment they are complaining about a missing junit dependency.