Cannot Retrieve Binary Data

From: patrick <pch(at)freeshell(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Cannot Retrieve Binary Data
Date: 2005-03-11 14:15:49
Message-ID: 5bd6ef364cb5f644245035172a720b30@freeshell.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi all ,
i'm following the example at
http://www.postgresql.org/docs/7.4/interactive/jdbc-binary-data.html
trying to retrieve previous stored file (more than 600MB) using the
following code:

Jdbc3ConnectionPool source = new Jdbc3ConnectionPool();
conn =
DriverManager.getConnection("jdbc:postgresql://localhost/backup",
"test", "test");
conn.setAutoCommit(false);
PreparedStatement ps = conn.prepareStatement("SELECT img
FROM images WHERE imgname = ?");
ps.setString(1, "civil.dmg");
ResultSet rs = ps.executeQuery();
if (rs != null) {
while (rs.next()) {
byte[] imgBytes = rs.getBytes(1);
// use the data in some way here
}
rs.close();
}
ps.close();
conn.commit();

during the executeQuery() i got a the following exception

java.sql.SQLException: ERROR: invalid memory alloc request size
2017394403

The Postgres version is 8.0.1 (compiled from source with default
settings ) running on Darwin Kernel Version 7.8.0

Thanks in advance for any help

-patrick

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sergio Lob 2005-03-11 14:56:35 Re: [BUGS] BUG #1523: precision column value returned from
Previous Message Rover, Mischa de 2005-03-11 13:20:40 Re: Crystal Reports: Connection rejected: FATAL: no