public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
     throws SQLException {
   try {
     byte[] data = new byte[length];
     x.read(data, 0, length);
     setBytes(parameterIndex, data);
   } catch (java.io.IOException e) {
     throw new SQLException("I/O failed");
   }
 }
 /**
  * When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical
  * to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until
  * it reaches end-of-file.
  *
  * <p><B>Note:</B> This stream object can either be a standard Java stream object or your own
  * subclass that implements the standard interface.
  *
  * @param parameterIndex the first parameter is 1, the second is 2, ...
  * @param x the java input stream which contains the binary parameter value
  * @param length the number of bytes in the stream
  * @exception SQLException if a database-access error occurs.
  */
 public void setBinaryStream(int parameterIndex, java.io.InputStream x, int length)
     throws SQLException {
   if (length == 0) {
     setBytes(parameterIndex, null);
   }
   byte[] bs = new byte[length];
   int actlen;
   try {
     actlen = x.read(bs);
   } catch (java.io.IOException e) {
     SQLException newE =
         new SQLException("setBinaryStream: IO-Exception occured reading Stream" + e.toString());
     throw newE;
   }
   if (actlen != length) {
     throw new SQLException(
         "SetBinaryStream parameterized Length: "
             + Integer.toString(length)
             + " got length: "
             + Integer.toString(actlen));
   } else {
     try {
       actlen = x.read(bs);
     } catch (java.io.IOException e) {
       SQLException newE =
           new SQLException("setBinaryStream: IO-Exception occured reading Stream" + e.toString());
       throw newE;
     }
     if (actlen != -1) {
       throw new SQLException(
           "SetBinaryStream parameterized Length: "
               + Integer.toString(length)
               + " got more than that ");
     }
   }
   this.setBytes(parameterIndex, bs);
 }