pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedI do not understand the exception
2+ messages / 2 participants
[nested] [flat]
* I do not understand the exception
@ 2004-08-24 10:02 Jaap Bril <Jaap.Bril@inter.nl.net>
2004-08-24 15:07 ` Re: I do not understand the exception Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 2+ messages in thread
From: Jaap Bril @ 2004-08-24 10:02 UTC (permalink / raw)
To: pgsql-jdbc
I dont get the error here,
the exception is
SQLEXCEPTION:Storing thumbnail failed:
java.sql.SQLException: ERROR: Bad int8 external representation
"\377\330\377\340\ [.........]
The offending code is:
private void storeThumbnail(ConnectionPool connectionPool, byte[] tn) {
String thumbnail_insert = "INSERT INTO thumbnails VALUES (?)";
try {
dbConn = connectionPool.getConnection();
dbConn.setAutoCommit(false);
PreparedStatement ps = dbConn.prepareStatement(thumbnail_insert);
ps.setBytes(1, tn);
ps.executeUpdate();
ps.close();
}
catch (SQLException e){
System.out.println("SQLEX:Storing thumbnail failed: " + e );
}
}
tn is a
ByteArrayOutputStream().toByteArray() filled with a
JPEGCodec.createJPEGEncoder()
The table thumbnails has a bytea and a serial;
What can be wrong??
TIA
Jaap
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: I do not understand the exception
2004-08-24 10:02 I do not understand the exception Jaap Bril <Jaap.Bril@inter.nl.net>
@ 2004-08-24 15:07 ` Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 2+ messages in thread
From: Kris Jurka @ 2004-08-24 15:07 UTC (permalink / raw)
To: Jaap Bril <Jaap.Bril@inter.nl.net>; +Cc: pgsql-jdbc
On Tue, 24 Aug 2004, Jaap Bril wrote:
> the exception is
> SQLEXCEPTION:Storing thumbnail failed:
> java.sql.SQLException: ERROR: Bad int8 external representation
> "\377\330\377\340\ [.........]
>
> String thumbnail_insert = "INSERT INTO thumbnails VALUES (?)";
You are trying to put the byte array into your serial column. You need to
explicitly name the column you want in your insert statement.
Kris Jurka
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-08-24 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-08-24 10:02 I do not understand the exception Jaap Bril <Jaap.Bril@inter.nl.net>
2004-08-24 15:07 ` Kris Jurka <books@ejurka.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox