Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-4890

Different string to boolean conversion on embedded and client

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.7.1.1
    • 10.7.1.1
    • JDBC
    • None
    • Repro attached
    • Embedded/Client difference

    Description

      The following code fragment behaves differently on client and embedded:

      PreparedStatement ps = c.prepareStatement("values cast(? as boolean)");
      ps.setString(1, "TRUE");
      ResultSet rs = ps.executeQuery();
      rs.next();
      System.out.println(rs.getBoolean(1));

      Embedded prints "true". Client raises an exception:

      Exception in thread "main" java.sql.SQLDataException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
      at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:72)
      at org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:358)
      at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:884)
      at SetByte.main(SetByte.java:6)
      Caused by: org.apache.derby.client.am.SqlException: An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'BOOLEAN'.
      at org.apache.derby.client.am.PreparedStatement$PossibleTypes.throw22005Exception(PreparedStatement.java:3069)
      at org.apache.derby.client.am.PreparedStatement.setString(PreparedStatement.java:874)
      ... 1 more

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            rhillegas Richard N. Hillegas
            knutanders Knut Anders Hatlen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment