db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4964) Client driver fails to convert string to boolean with setObject(col, str, Types.BIT)
Date Thu, 13 Jan 2011 13:08:45 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4964?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-4964:
--------------------------------------

    Attachment: mapping-test.diff

Attaching a patch that makes ParameterMappingTest expose the bug. ParameterMappingTest only
tested setObject(int,Object) before. The patch adds testing of setObject(int,Object,int),
which is where the problem is seen. The test passes with the embedded driver and fails on
the client driver when the patch is applied.

> Client driver fails to convert string to boolean with setObject(col, str, Types.BIT)
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-4964
>                 URL: https://issues.apache.org/jira/browse/DERBY-4964
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.7.1.1
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: mapping-test.diff
>
>
> The following code
>         PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
>         ps.setObject(1, "true", Types.BIT);
>         ResultSet rs = ps.executeQuery();
>         rs.next();
>         System.out.println(rs.getString(1));
> executes successfully using the embedded driver, but fails when using the client driver:
> Exception in thread "main" java.sql.SQLDataException: Invalid character string format
for type INTEGER.
> 	at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
> 	at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.setObject(Unknown Source)
> 	at Test.main(Test.java:8)
> Caused by: org.apache.derby.client.am.SqlException: Invalid character string format for
type INTEGER.
> 	at org.apache.derby.client.am.CrossConverters.setObject(Unknown Source)
> 	at org.apache.derby.client.am.CrossConverters.setObject(Unknown Source)
> 	at org.apache.derby.client.am.PreparedStatement.setObjectX(Unknown Source)
> 	... 2 more
> Caused by: java.lang.NumberFormatException: For input string: "true"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> 	at java.lang.Integer.parseInt(Integer.java:449)
> 	at java.lang.Integer.valueOf(Integer.java:554)
> 	... 5 more
> This issue was found when running the Java EE CTS with Derby 10.7.1.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message