commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Fabulich (JIRA)" <>
Subject [jira] Created: (DBUTILS-55) Oracle: Can't insert null into BFILE parameter
Date Mon, 13 Apr 2009 06:03:14 GMT
Oracle: Can't insert null into BFILE parameter

                 Key: DBUTILS-55
             Project: Commons DbUtils
          Issue Type: Bug
    Affects Versions: 1.2
            Reporter: Dan Fabulich
            Priority: Trivial

Download and install Oracle Express Edition (XE) 10.2 (it's free)

Run "sqlplus" and create a table like this: "create table dbutilstest(col1 bfile);"

Then, using the JDBC jar from here

Run this:

OracleDataSource ds = new oracle.jdbc.pool.OracleDataSource();
QueryRunner runner = new QueryRunner(ds);
runner.update("INSERT INTO dbutilstest(col1) values (?)", new Object[] {null});

Expected: Code should run without error
Actual: Exception in thread "main" java.sql.SQLException: ORA-00932: inconsistent datatypes:
expected FILE got CHAR
 Query: INSERT INTO dbutilstest(col1) values (?) Parameters: [null]
	at org.apache.commons.dbutils.QueryRunner.rethrow(
	at org.apache.commons.dbutils.QueryRunner.update(
	at org.apache.commons.dbutils.QueryRunner.update(

Why is this happening?  Because Oracle's JDBC driver doesn't support ParameterMetaData.getParameterType,
we coded up a workaround to call PreparedStatement.setNull(index, java.sql.Types.VARCHAR)
by default when we can't determine the parameter type (e.g. Oracle).  This works for most
column types, but not BFILE.  For BFILE, you get the error above.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message