Why can I get java.lang.AbstractMethodError when trying to load a blob into t...

I've got a problem with JDBC.

I'have the following code:

//blargeparam is a blob column.
PreparedStatement pst =connection.prepareStatement("update gcp_processparams_log set blargeparam= ? where idprocessparamslog=1");

pst.setBinaryStream(1,inputStream);

I get the following error:

Exception in thread "main" java.lang.AbstractMethodError:
oracle.jdbc.driver.T2CPreparedStatement.setBinaryStream(ILjava/io/InputStream;)V

My connection string is jdbc:oracle:oci:@.....

The Oracle version is 11g.

From the error message it seems that something is missing but:

  • when I read from the same blob column (with blob.getBytes) everything works.
  • The DLL's of the instant client are (correctly) in the library path.
  • This is the manifest of the Oracle JDBC JAR in my class path:

    Manifest-Version: 1.0
    Specification-Title:    Oracle JDBC driver classes for use with JDK14
    Sealed: true
    Created-By: 1.4.2_14 (Sun Microsystems Inc.)
    Implementation-Title:   ojdbc14.jar
    Specification-Vendor:   Oracle Corporation
    Specification-Version:  Oracle JDBC Driver version - "10.2.0.4.0"
    Implementation-Version: Oracle JDBC Driver version - "10.2.0.4.0"
    Implementation-Vendor:  Oracle Corporation
    Implementation-Time:    Sat Feb  2 11:40:29 2008

With JDBC, that error usually occurs because your JDBC driver implements an older version of the JDBC API than the one included in your JRE. These older versions are fine so long as you don't try and use a method that appeared in the newer API.

I'm not sure what version of JDBC setBinaryStream appeared in. It's been around for a while, I think.

Regardless, your JDBC driver version (10.2.0.4.0) is quite old, I recommend upgrading it to the version that was released with 11g (down here ), and try again.