[ 
https://issues.apache.org/jira/browse/DERBY-7103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17295372#comment-17295372
 ] 

Richard N. Hillegas commented on DERBY-7103:
--------------------------------------------

Thanks for that explanation. Attaching Derby_7103.java, a repro which 
demonstrates this behavior. Here is the output of that program:

{noformat}
PROCEDURE_CAT has type VARCHAR of JDBC type 12 and Java type null
PROCEDURE_SCHEM has type VARCHAR of JDBC type 12 and Java type java.lang.String
PROCEDURE_NAME has type VARCHAR of JDBC type 12 and Java type java.lang.String
COLUMN_NAME has type VARCHAR of JDBC type 12 and Java type java.lang.String
COLUMN_TYPE has type SMALLINT of JDBC type 5 and Java type java.lang.Integer
DATA_TYPE has type INTEGER of JDBC type 4 and Java type java.lang.Integer
TYPE_NAME has type VARCHAR of JDBC type 12 and Java type java.lang.String
PRECISION has type INTEGER of JDBC type 4 and Java type java.lang.Integer
LENGTH has type INTEGER of JDBC type 4 and Java type java.lang.Integer
SCALE has type SMALLINT of JDBC type 5 and Java type java.lang.Integer
RADIX has type SMALLINT of JDBC type 5 and Java type java.lang.Integer
NULLABLE has type SMALLINT of JDBC type 5 and Java type java.lang.Integer
REMARKS has type VARCHAR of JDBC type 12 and Java type null
COLUMN_DEF has type VARCHAR of JDBC type 12 and Java type null
SQL_DATA_TYPE has type INTEGER of JDBC type 4 and Java type null
SQL_DATETIME_SUB has type INTEGER of JDBC type 4 and Java type null
CHAR_OCTET_LENGTH has type INTEGER of JDBC type 4 and Java type 
java.lang.Integer
ORDINAL_POSITION has type INTEGER of JDBC type 4 and Java type java.lang.Integer
IS_NULLABLE has type VARCHAR of JDBC type 12 and Java type java.lang.String
SPECIFIC_NAME has type VARCHAR of JDBC type 12 and Java type java.lang.String
METHOD_ID has type SMALLINT of JDBC type 5 and Java type java.lang.Integer
PARAMETER_ID has type SMALLINT of JDBC type 5 and Java type java.lang.Integer
{noformat}

The Java objects returned by java.sql.ResultSet.getObject() for SMALLINT-typed 
columns should be Integers, not Shorts, according to appendix B.3 of the JDBC 
4.3 spec. This is a longstanding oddity of the JDBC spec, whose motivation I 
don't understand. Nevertheless, Derby's behavior looks correct to me.


> getProcedureColumn(...)/SCALE is Integer not Short
> --------------------------------------------------
>
>                 Key: DERBY-7103
>                 URL: https://issues.apache.org/jira/browse/DERBY-7103
>             Project: Derby
>          Issue Type: Improvement
>          Components: JDBC
>    Affects Versions: 10.14.2.0
>            Reporter: Jin Kwon
>            Priority: Trivial
>         Attachments: Derby_7103.java
>
>
> When 
> [getProcedureColumns(...)|https://docs.oracle.com/en/java/javase/11/docs/api/java.sql/java/sql/DatabaseMetaData.html#getProcedureColumns(java.lang.String,java.lang.String,java.lang.String,java.lang.String)]
>  invoked, the {{SCALE}} column returns an {{Integer}} not an {{Short}}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to