Retrieving bytes error(complete mail)!!

Поиск
Список
Период
Сортировка
От FERNANDA M.
Тема Retrieving bytes error(complete mail)!!
Дата
Msg-id 20031023232618.70615.qmail@web13806.mail.yahoo.com
обсуждение исходный текст
Список pgsql-jdbc
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();



But when i'm trying to retrieve the document i get the
following error:

Connection is closed.  Operation is not permitted.
        at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:480)
        at
org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:461)
        at
org.postgresql.jdbc1.AbstractJdbc1Connection.getSQLType(AbstractJdbc1Connection.java:1271)
        at
org.postgresql.jdbc1.AbstractJdbc1Connection.getPGType(AbstractJdbc1Connection.java:1335)
        at
org.postgresql.Field.getPGType(Field.java:93)
        at
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getBytes(AbstractJdbc1ResultSet.java:196)
        at
org.postgresql.jdbc1.AbstractJdbc1ResultSet.getBinaryStream(AbstractJdbc1ResultSet.java:318)



I'm trying to get the data with this method from the
result set...
is  = rs.getBinaryStream(1);
                    is.read(docBytes);

and the error is exactly in the rs.getBinaryStream(1);

Does anybody knows why i get this strange error.

Thank you!
Fernanda




=====
.................... 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

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: "FERNANDA M."
Дата:
Сообщение: Retrieving bytes error!!
Следующее
От: "Mike Kenny - CPX Mngd Services"
Дата:
Сообщение: No suitable driver