Search This Blog

Tuesday, 18 September 2007

OracleDatabaseMetaData.getLobPrecision Returns Precision Of -1

When using the following code with the 10.2.0.3 JDBC driver it always results in -1 for the lob precision.

Code:

System.out.println( "LOB Precision: " +
((oracle.jdbc.OracleDatabaseMetaData)dbMeta).getLobPrecision());

Output:

LOB Precision: -1

The same code would give the lob precision correctly when using the 10.1.0.5 JDBC driver. This is an undocumented property which caused OracleDatabaseMetaData.getLobPrecision to return the string "-1". The JDBC driver now returns lob precision as -1 since, the precision value cannot fit into an int return value of the method.

To overcome this issue you can now use code as follows with the 10.2.0.3 JDBC Driver.

System.out.println( "LOB Precision: " +
((oracle.jdbc.OracleDatabaseMetaData)dbMeta).getLobMaxLength());

No comments: