>
> Doesn't this [code] just confirm my remark:
>

That you need oracle-specific code to exceed the 4K limit? It does not
confirm that because it fails under jboss and works everywhere else. The
oracle-specific code is just a convenience after using vanilla JDBC to get
the blob, but that's not very satisfactory I agree. I still hold there is no
4K limit using JDBC calls.

> FileInputStream? What file?
>
> I must confess that it has never occurred to me to pass an InputStream
> to setObject. What makes you think that will work (on all/most
> platforms).

Sure, as long as it implements the Blob interface which is straight forward:

MagicStream extends InputStream implements Blob{
    byte[] data;
    MagicStream(String filename) {
        super(filename);
        data = new byte[available()];
        read(data);
        close();
    }
    public InputStream getInputStream() { return new
ByteArrayInputStream(data); }
    public byte[] getBytes(long pos, int length) { . }
    public long length() { ... }
     ...
}

Of course, a prepared statement would be more convenient in most
circumstances:

File file = new File("foo.xls");
InputStream stream = new FileInputStream(file);
PreparedStatement statement = connnection.prepareStatement(
        "UPDATE BAR SET FOO = ? WHERE BAR_ID = 1");
statement.setBinaryStream(1, stream, file.length());
statement.executeUpdate();








-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to