[
https://issues.apache.org/jira/browse/DERBY-5788?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13396690#comment-13396690
]
Knut Anders Hatlen commented on DERBY-5788:
-------------------------------------------
9.3.3 BIT in the above mentioned URL, on the other hand, says that the
recommended Java mapping is a Java boolean, whose string representation is
"true"/"false", so I suppose it could be interpreted either way. :)
One thing I notice, is that the code in CTS 6 appears to be more liberal and
accept both drivers that use "1"/"0" for setObject(...,BIT) and those that use
"true"/"false", regardless of their support for BOOLEAN. The version of the CTS
that found DERBY-4964, was an older one (1.4.1 IIRC), which required databases
without support for BOOLEAN to accept "1"/"0", and those that did support
BOOLEAN had to accept "true"/"false". It might be that we wouldn't have had to
make that change if we had used a newer CTS to vet the 10.8 release.
I suppose supporting both types of conversion wouldn't cause much harm, though.
> BIT support regression and confusing message in 10.8.2.2:
> org.apache.derby.client.am.SqlException: Invalid character string format for
> type BOOLEAN
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: DERBY-5788
> URL: https://issues.apache.org/jira/browse/DERBY-5788
> Project: Derby
> Issue Type: Bug
> Components: JDBC
> Affects Versions: 10.8.2.2
> Environment: Windows 7 (All)
> Reporter: Radoslav Ivanov
>
> Scenario (on 10.8.2.2; with 10.5.1.1 the problem does not appear): when
> setting BIT from this example :
> rsSch.createTab("Bit_Tab",sqlp,conn);
> String sMaxBooleanVal = rsSch.extractVal("Bit_Tab",1,sqlp,conn); //value is
> “1“
> cstmt = conn.prepareCall("{call Bit_In_Min(?)}");
> cstmt.setObject(1,sMaxBooleanVal,java.sql.Types.BIT); //-> throws the
> exception below
> Exception (Problem with not supporting “0” and “1” for the type BIT;
> moreover, confusing message):
> java.sql.SQLDataException: Invalid character string format for type BOOLEAN.
> 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
> org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
> at
> org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
> at
> com.sun.ts.tests.jdbc.ee.callStmt.callStmt10.callStmtClient10.testSetObject48(callStmtClient10.java:812)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira