View Single Post

   
  #1 (permalink)  
Old 04-15-2008, 11:04 PM
Tore Halset
 
Posts: n/a
Default pst.setNull(2, Types.BLOB)

Hello.

I have just tried to upgrade my jdbc driver, but have a problem with
setNull for blobs. I am using postgresql-8.0-310.jdbc3.jar with
commons-dbcp-1.2.1.jar and postgresql-8.0.1.

The test table:
create table blobtest (a int primary key, b bytea);

Sql to reproduce the problem:
Connection conn = ...
PreparedStatement st = conn.prepareStatement("insert into
blobtest (a,b) values (?,?)");
st.setInt(1, 5);
st.setNull(2, Types.BLOB);
st.execute();
conn.commit();

Stacktrace:
org.postgresql.util.PSQLException: Unknown Types value.
at
org.postgresql.jdbc2.AbstractJdbc2Statement.setNul l(AbstractJdbc2Stateme
nt.java:1003)
at
org.postgresql.jdbc3.AbstractJdbc3Statement.setNul l(AbstractJdbc3Stateme
nt.java:1445)
at
org.apache.commons.dbcp.DelegatingPreparedStatemen t.setNull(DelegatingPr
eparedStatement.java:104)

Looks like AbstractJdbc2Statement are handling BINARY,VARBINARY and
LONGVARBINARY, but not BLOB. Is this a bug or should I not use
Types.BLOB?

Regards,
- Tore.


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply With Quote