XML DB Content Connector unable to accept binary content due to Invalid argument(s) in call oracle.sql.BLOB.setBinaryStream(0L)
- by sthieme
Dear Readers,
I am working on implementing a custom Document Management System using the Oracle XML DB Content Connector. See the following documentation link for details
Oracle XML DB Developer's Guide 11g Release 2 (11.2)Chapter 31 Using Oracle XML DB Content Connectorhttp://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_jcr.htm
especially the following example gave me some trouble to run it successfully
Sample Code to Upload Filehttp://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb_jcr.htm#ADXDB5627
I had already succeeded to set some of the properties successfully, i.e.
jcr:encoding, jcr:mimeType, ojcr:displayName and ojcr:language.
However
setting the jcr:data property as described in the example failed
consistently, both with the documented input FileStream or with a fixed
string.
contentNode.setProperty("jcr:data", "mystringvalue");
After some research I found the following Support Note which describes the cause for the issue in the JDBC driver version 11.2.0.1. Error "ORA-17068: Invalid argument(s) in call" Using Method setBinaryStream(0L) in JDBC 11.2.0.1 (Doc ID 1234235.1)https://support.oracle.com/epmos/faces/DocContentDisplay?id=1234235.1It can easily be solved by upgrading to JDBC 11.2.0.2 or worked around using the following property setting:
java -Doracle.jdbc.LobStreamPosStandardCompliant=false ...
Kind regards,Stefan
C:\Oracle\Database\product\11.2.0\dbhome_1>java -Doracle.jdbc.LobStreamPosStandardCompliant=false UploadFile jdbc:oracle:oci:@localhost:1522:orcl XDB welcome1 /public MyFile.txt text/plain
19.08.2014 11:50:26 oracle.jcr.impl.OracleRepositoryImpl login
INFO: JCR repository descriptors:
query.xpath.pos.index = true
option.versioning.supported = false
jcr.repository.version = 11.1.0.0.0
option.observation.supported = false
option.locking.supported = false
oracle.jcr.framework.version = 11.1.0.0.0
query.xpath.doc.order = false
jcr.specification.version = 1.0
jcr.repository.vendor = Oracle
option.query.sql.supported = false
jcr.specification.name = Content Repository for Java Technology API
level.2.supported = true
level.1.supported = true
jcr.repository.name = XML DB Content Connector
jcr.repository.vendor.url = http://www.oracle.com
oracle.jcr.persistenceManagerFactory = oracle.jcr.impl.xdb.XDBPersistenceManagerFactory
option.transactions.supported = false
19.08.2014 11:50:26 oracle.jcr.impl.OracleRepositoryImpl login
INFO: Session Session-1 connected for user id XDB
19.08.2014 11:50:27 oracle.jcr.impl.OracleSessionImpl logout
INFO: Session-1: logout
instead of
C:\Oracle\Database\product\11.2.0\dbhome_1>java UploadFile jdbc:oracle:oci:@localhost:1522:orcl XDB welcome1 /public MyFile.txt text/plain
19.08.2014 10:56:39 oracle.jcr.impl.OracleRepositoryImpl login
INFO: JCR repository descriptors:
query.xpath.pos.index = true
option.versioning.supported = false
jcr.repository.version = 11.1.0.0.0
option.observation.supported = false
option.locking.supported = false
oracle.jcr.framework.version = 11.1.0.0.0
query.xpath.doc.order = false
jcr.specification.version = 1.0
jcr.repository.vendor = Oracle
option.query.sql.supported = false
jcr.specification.name = Content Repository for Java Technology API
level.2.supported = true
level.1.supported = true
jcr.repository.name = XML DB Content Connector
jcr.repository.vendor.url = http://www.oracle.com
oracle.jcr.persistenceManagerFactory = oracle.jcr.impl.xdb.XDBPersistenceManagerFactory
option.transactions.supported = false
19.08.2014 10:56:39 oracle.jcr.impl.OracleRepositoryImpl login
INFO: Session Session-1 connected for user id XDB
Exception in thread "main" javax.jcr.RepositoryException: Unable to accept binary content
at oracle.jcr.impl.ExceptionFactory.repository(ExceptionFactory.java:142)
at oracle.jcr.impl.ExceptionFactory.otherwiseFailed(ExceptionFactory.java:98)
at oracle.jcr.impl.xdb.XDBPersistenceManager.acceptBinaryStream(XDBPersistenceManager.java:1421)
at oracle.jcr.impl.xdb.XDBResource.setContent(XDBResource.java:898)
at oracle.jcr.impl.ContentNode.setProperty(ContentNode.java:472)
at oracle.jcr.impl.OracleNode.setProperty(OracleNode.java:1439)
at oracle.jcr.impl.OracleNode.setProperty(OracleNode.java:460)
at UploadFile.main(UploadFile.java:54)
Caused by: java.sql.SQLException: Invalid argument(s) in call
at oracle.jdbc.driver.T2CConnection.newOutputStream(T2CConnection.java:2392)
at oracle.sql.BLOB.setBinaryStream(BLOB.java:893)
at oracle.jcr.impl.xdb.XDBPersistenceManager.acceptBinaryStream(XDBPersistenceManager.java:1393)
... 5 more