I'm trying to retrieve a VECTOR OUT parameter from a stored procedure using CallableStatement, following the JDBC documentation which states that when using `registerOutParameter` with a specific vector type, `getObject(int)` should automatically convert to the appropriate Java array type.
However, I'm getting an error that suggests no default conversion is available, even though I've explicitly registered the parameter type.
Environment
- Oracle Database: 23ai/26ai (with VECTOR support)
- JDBC Driver: ojdbc17 (23.26.0.0.0)
- Java Version: 17
Stored Procedure
CREATE OR REPLACE PROCEDURE test_vec_f32_out(v OUT VECTOR) AS
BEGIN
SELECT vec INTO v FROM (SELECT '[1.1, 2.2, 3.3]' AS vec FROM DUAL);
END;
JAVA
String sql = "{call test_vec_f32_out(?)}";
try (CallableStatement cstmt = conn.prepareCall(sql)) {
// Register OUT parameter with specific VECTOR type
cstmt.registerOutParameter(1, OracleTypes.VECTOR_FLOAT32);
cstmt.execute();
// According to documentation, this should return float[]
float[] outputVector = (float[]) cstmt.getObject(1);
System.out.println("Output: " + Arrays.toString(outputVector));
}
Error Message
java.sql.SQLException: ORA-17004: Invalid column type: JDBC 4.3 does not specify a default conversion for VECTOR. A default conversion may be configured using the "oracle.jdbc.vectorDefaultGetObjectType" connection property
https://docs.oracle.com/error-help/db/ora-17004/
at oracle.jdbc.driver.VectorAccessor.getObject(VectorAccessor.java:186)
at oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:1748)
Expected Behavior
According to the JDBC Developer's Guide - Section 14.2, when registering an OUT parameter with OracleTypes.VECTOR_FLOAT32, the getObject() method should automatically convert the result to float[] without requiring a Class argument.
"With this registration, the following conversions are performed by the getObject methods, if no Class argument is provided:
- A Vector of FLOAT32 values is converted to a float[]."
Actual Behavior
The getObject(int) method fails with ORA-17004, stating that no default conversion is available for VECTOR type.
Workaround
Using getObject(1, float[].class) works, but according to the documentation, this shouldn't be necessary when the parameter type is explicitly registered.
Questions
- Is this a known limitation or bug in the current JDBC driver?
- Should registerOutParameter(index, OracleTypes.VECTOR_FLOAT32) enable automatic conversion for getObject(index)?
- Is there a specific JDBC driver version that properly supports this functionality?
- Does the OUT parameter type in PL/SQL need to be more specific than just
VECTOR?
Any guidance would be appreciated. Thank you!