Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

oracle - Why do I get java.lang.AbstractMethodError when trying to load a blob in the db?

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  
    
Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 (download here), and try again.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...