pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #1780: JDBC driver "setNull" throws for BLOB and CLOB columns
5+ messages / 2 participants
[nested] [flat]
* BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB columns
@ 2005-07-22 08:45 Andrus Adamchik <andrus@objectstyle.org>
0 siblings, 1 reply; 5+ messages in thread
From: Andrus Adamchik @ 2005-07-22 08:45 UTC (permalink / raw)
To: pgsql-bugs@postgresql.org
The following bug has been logged online:
Bug reference: 1780
Logged by: Andrus Adamchik
Email address: andrus@objectstyle.org
PostgreSQL version: 8.0.1
Operating system: Mac OS X 10.4
Description: JDBC driver "setNull" throws for BLOB and CLOB columns
Details:
Whenver I call PreparedStatement.setNull(int, int) on BLOB or CLOB columns,
an exception below occurs. Driver version: postgresql-8.0-310.jdbc3.jar. But
looks like latest CVS version has the same problem.
Test case:
Driver d = new org.postgresql.Driver();
Properties p = new Properties();
p.put("user", "andrus");
p.put("password", "andrus");
Connection c =
d.connect("jdbc:postgresql://localhost:5432/cayenne", p);
PreparedStatement st = c
.prepareStatement("insert into BLOB_TEST (BLOB_TEST_ID,
BLOB_COL) values (?, ?)");
st.setInt(1, 1);
// this is the line where it blows:
st.setNull(2, Types.BLOB);
Stack trace:
org.postgresql.util.PSQLException: Unknown Types value.
at
org.postgresql.jdbc2.AbstractJdbc2Statement.setNull(AbstractJdbc2Statement.j
ava:1003)
at
org.postgresql.jdbc3.AbstractJdbc3Statement.setNull(AbstractJdbc3Statement.j
ava:1445)
at NullBlob.main(NullBlob.java:24)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB
@ 2005-07-22 18:53 Kris Jurka <books@ejurka.com>
parent: Andrus Adamchik <andrus@objectstyle.org>
0 siblings, 1 reply; 5+ messages in thread
From: Kris Jurka @ 2005-07-22 18:53 UTC (permalink / raw)
To: Andrus Adamchik <andrus@objectstyle.org>; +Cc: pgsql-bugs@postgresql.org; pgsql-jdbc
On Fri, 22 Jul 2005, Andrus Adamchik wrote:
> Bug reference: 1780
> PostgreSQL version: 8.0.1
> Description: JDBC driver "setNull" throws for BLOB and CLOB columns
> Details:
>
> Whenver I call PreparedStatement.setNull(int, int) on BLOB or CLOB columns,
> an exception below occurs. Driver version: postgresql-8.0-310.jdbc3.jar. But
> looks like latest CVS version has the same problem.
>
>
This has been fixed in CVS for the 8.0 and development drivers, we just
haven't done a release in nearly three months. I'll put out a release
this weekend unless there are any other outstanding fixes I'm unaware of.
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [JDBC] BUG #1780: JDBC driver "setNull" throws for BLOB
@ 2005-07-22 19:40 Kris Jurka <books@ejurka.com>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 5+ messages in thread
From: Kris Jurka @ 2005-07-22 19:40 UTC (permalink / raw)
To: Andrus Adamchik <andrus@objectstyle.org>; +Cc: pgsql-bugs@postgresql.org; pgsql-jdbc
On Fri, 22 Jul 2005, Kris Jurka wrote:
> On Fri, 22 Jul 2005, Andrus Adamchik wrote:
>
> > Whenver I call PreparedStatement.setNull(int, int) on BLOB or CLOB columns,
> > an exception below occurs. Driver version: postgresql-8.0-310.jdbc3.jar. But
> > looks like latest CVS version has the same problem.
> >
>
> This has been fixed in CVS for the 8.0 and development drivers, we just
> haven't done a release in nearly three months. I'll put out a release
> this weekend unless there are any other outstanding fixes I'm unaware of.
>
Actually looking more closely, this was fixed in build 311 which is
available, but we should still put out a new release for other fixes.
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB
@ 2005-08-01 11:40 Andrus Adamchik <andrus@objectstyle.org>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 1 reply; 5+ messages in thread
From: Andrus Adamchik @ 2005-08-01 11:40 UTC (permalink / raw)
To: Kris Jurka <books@ejurka.com>; +Cc: pgsql-bugs@postgresql.org; pgsql-jdbc
Just tested it with build 312 and the original problem went away. Now
I am seeing a new problem with null BLOBs only:
java.sql.SQLException: ERROR: column "blob_col" is of type bytea but
expression is of type oid
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse
(QueryExecutorImpl.java:1471)
at org.postgresql.core.v3.QueryExecutorImpl.processResults
(QueryExecutorImpl.java:1256)
at org.postgresql.core.v3.QueryExecutorImpl.execute
(QueryExecutorImpl.java:175)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
(AbstractJdbc2Statement.java:389)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags
(AbstractJdbc2Statement.java:330)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute
(AbstractJdbc2Statement.java:321)
at NullBlob.main(NullBlob.java:26)
In other words "bytea" columns allow inserting non-null blobs, but
null generates the exception above. Here is sample code:
PreparedStatement st = c
.prepareStatement("insert into BLOB_TEST (BLOB_TEST_ID,
BLOB_COL) values (?, ?)");
st.setInt(1, 1);
st.setNull(2, Types.BLOB);
st.execute(); // this line throws the exception above
Andrus
On Jul 22, 2005, at 11:40 PM, Kris Jurka wrote:
>
>
> On Fri, 22 Jul 2005, Kris Jurka wrote:
>
>
>> On Fri, 22 Jul 2005, Andrus Adamchik wrote:
>>
>>
>>> Whenver I call PreparedStatement.setNull(int, int) on BLOB or
>>> CLOB columns,
>>> an exception below occurs. Driver version:
>>> postgresql-8.0-310.jdbc3.jar. But
>>> looks like latest CVS version has the same problem.
>>>
>>>
>>
>> This has been fixed in CVS for the 8.0 and development drivers, we
>> just
>> haven't done a release in nearly three months. I'll put out a
>> release
>> this weekend unless there are any other outstanding fixes I'm
>> unaware of.
>>
>>
>
> Actually looking more closely, this was fixed in build 311 which is
> available, but we should still put out a new release for other fixes.
>
> Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [JDBC] BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB
@ 2005-08-01 15:12 Kris Jurka <books@ejurka.com>
parent: Andrus Adamchik <andrus@objectstyle.org>
0 siblings, 0 replies; 5+ messages in thread
From: Kris Jurka @ 2005-08-01 15:12 UTC (permalink / raw)
To: Andrus Adamchik <andrus@objectstyle.org>; +Cc: pgsql-bugs@postgresql.org; pgsql-jdbc
On Mon, 1 Aug 2005, Andrus Adamchik wrote:
> Just tested it with build 312 and the original problem went away. Now
> I am seeing a new problem with null BLOBs only:
>
> java.sql.SQLException: ERROR: column "blob_col" is of type bytea but
> expression is of type oid
bytea is not the correct type to use when storing Blobs. You need to use
oid as the underlying type, or if you want to use bytea you need to use
setBytes or setNull(x, Types.BINARY).
Kris Jurka
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-08-01 15:12 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-07-22 08:45 BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB columns Andrus Adamchik <andrus@objectstyle.org>
2005-07-22 18:53 ` Re: BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB Kris Jurka <books@ejurka.com>
2005-07-22 19:40 ` Re: [JDBC] BUG #1780: JDBC driver "setNull" throws for BLOB Kris Jurka <books@ejurka.com>
2005-08-01 11:40 ` Re: BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB Andrus Adamchik <andrus@objectstyle.org>
2005-08-01 15:12 ` Re: [JDBC] BUG #1780: JDBC driver "setNull" throws for BLOB and CLOB 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