db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <derby-...@db.apache.org>
Subject [jira] Updated: (DERBY-1500) PreparedStatement#setObject(int parameterIndex, Object x) throws SQL Exception when binding Short value in embedded mode
Date Sat, 19 Aug 2006 21:51:15 GMT
     [ http://issues.apache.org/jira/browse/DERBY-1500?page=all ]

Knut Anders Hatlen updated DERBY-1500:
--------------------------------------

    Attachment: derby-1500.diff
                derby-1500.stat

Attached is a fix for the issue. I haven't seen the updated JDBC 4.0 spec myself, but I have
assumed that the new rows for Byte and Short in table B-5 of the spec are identical to the
ones for BigDecimal, Boolean, Integer, Long, Float and Double.

setObject(int, Byte) is translated to setByte(int, byte)
setObject(int, Short) is translated to setShort(int, short)

Test cases for Byte and Short have been added to jdbcapi/parameterMapping.java.

All master files for parameterMapping were updated. I have verified that embedded, DerbyNetClient
and DerbyNet work. The five others (j9_foundation, j9_13, DerbyNet/ver2.6, DerbyNet/v2.8 and
DerbyNet/ibm15) were updated following the same pattern, but I haven't tested those.

Derbyall ran successfully on Solaris 10 x64, Sun JVM 1.5.0. The patch is ready for review.
Thanks!

> PreparedStatement#setObject(int parameterIndex, Object x) throws SQL Exception when binding
Short value in embedded mode
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-1500
>                 URL: http://issues.apache.org/jira/browse/DERBY-1500
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.1.1.0, 10.1.3.1
>         Environment: WindowsXP
>            Reporter: Markus Fuchs
>         Assigned To: Knut Anders Hatlen
>             Fix For: 10.2.1.0
>
>         Attachments: derby-1500.diff, derby-1500.stat, ShortTest.java
>
>
> When trying to insert a row into the table 
> SHORT_TEST( ID int, SHORT_VAL smallint)
> an exception is thrown, if the object value given to PreparedStatement#setObject(int
parameterIndex, Object x) is of type Short. The exception thrown is:
> --- SQLException ---
> SQLState:  22005
> Message:  An attempt was made to get a data value of type 'SMALLINT' from a data value
of type 'java.lang.Short'.
> ErrorCode:  20000
> SQL Exception: An attempt was made to get a data value of type 'SMALLINT' from a data
value of type 'java.lang.Short'.
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.dataTypeConversion(Unknown Source)
> 	at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setObject(Unknown Source)
> Tested on Derby 10.1.1.0 and 10.1.3.1. The same test runs fine in network mode.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message