Thread: Retrieving bytes error!!

Retrieving bytes error!!

From
"FERNANDA M."
Date:
Hello! i have  problem when retrieving a byte array
from postgres.

I'm saving a file (open office) with the following
code...

FileInputStream fis = new
FileInputStream(doc.getFile());
length = (doc.getFile()).length();
PreparedStatement ps = connection.prepareStatement
                                   ("INSERT INTO
documents VALUES (?, ?, ?, ?)");
            ps.setInt(1, doc.getDocumentId());
            ps.setString(2, doc.getFileName());
            ps.setDate(3, new
java.sql.Date(System.currentTimeMillis()));
ps.setBinaryStream(4, fis, (int) length);
            ps.close();


            int insertado=ps.executeUpdate();




=====
.................... F E R D I ............................
Les choses simples sont les plus extraordinaires,
et seuls les savants parviennent � les voir...L'Alchimiste

ferdim@yahoo.com
ferdim79@msn.com

http://geocities.com/ferdim

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com