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

Knut Anders Hatlen commented on DERBY-5788:
-------------------------------------------

Derby doesn't actually have a Bit data type, but it uses java.sql.Types.BIT as 
an alias for java.sql.Types.BOOLEAN internally. This is for historical reasons, 
I believe, as the java.sql.Types.BOOLEAN constant wasn't introduced until JDBC 
3.0, and Derby used java.sql.Types.BIT to identify Boolean values before that. 
(Derby did support Boolean values in older releases too, but it wasn't exposed 
via SQL until version 10.7.)

Earlier today I obtained a copy of the Java EE 6 CTS and started the JDBC 
sub-suite with GlassFish 3.1.2 and the Derby 10.9.1.0 release candidate. It 
still hasn't completed, but at least it appears to have passed the test case in 
which you saw the problem:

[javatest.batch] 06-13-2012 04:35:49:  ***************************************
[javatest.batch] 06-13-2012 04:35:49:   get the CallableStatement object
[javatest.batch] 06-13-2012 04:35:49:   execute the procedure
[javatest.batch] 06-13-2012 04:35:49:   Select MIN_VAL from Bit_Tab
[javatest.batch] 06-13-2012 04:35:49:   setObject method sets the designated 
parameter with the object
[javatest.batch] 06-13-2012 04:35:49:  ***************************************
[javatest.batch] 06-13-2012 04:35:49:  Expected Output..... true  Obtained 
Output..... true
[javatest.batch] 06-13-2012 04:35:49:  ***************************************
[javatest.batch] 06-13-2012 04:35:49:  Closed the Data Base connection
[javatest.batch] 06-13-2012 04:35:49:  Cleanup ok;
[javatest.batch] STATUS:Passed.
[javatest.batch] 
********************************************************************************
[javatest.batch] Finished Test:  
PASSED........com/sun/ts/tests/jdbc/ee/callStmt/callStmt10/callStmtClient10.java#testSetObject48_from_appclient
[javatest.batch] 
********************************************************************************
[javatest.batch] Number of tests completed:  173 (173 passed, 0 failed, 0 with 
errors)
[javatest.batch] 
********************************************************************************

I used the 24-Jan-2012 patch release of the CTS, which contained some changes 
in the Derby-specific DDL scripts and stored procedures, according to the 
release notes. Maybe you are using an earlier release of the CTS?
                
> 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


Reply via email to