You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Thomas Dudziak (JIRA)" <de...@db.apache.org> on 2005/12/18 12:21:34 UTC

[jira] Created: (DERBY-773) PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR

PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR
--------------------------------------------------------------------------------------------------

         Key: DERBY-773
         URL: http://issues.apache.org/jira/browse/DERBY-773
     Project: Derby
        Type: Bug
  Components: JDBC  
    Versions: 10.1.2.1    
 Environment: Windows XP
Java 1.5
Derby in Embedded or Network mode
    Reporter: Thomas Dudziak


When using 

    PreparedStatement ps = ...
    Character value = ...

    ps.setObject(0, value, Types.CHAR);

or

    ps.setObject(0, value, Types.VARCHAR);

Derby complains with

    "An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.lang.Character'."

Currently a workaround with

    ps.setObject(0, value.toString(), Types.CHAR);

is necessary.

-- 
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


[jira] Commented: (DERBY-773) PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR

Posted by "Thomas Dudziak (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-773?page=comments#action_12360750 ] 

Thomas Dudziak commented on DERBY-773:
--------------------------------------

While this is true, I think it is beside the point. IMHO a JDBC driver should as a convenience feature for their users support all native Java types (e.g. the respective java.lang counterparts of byte, short, char, ...) in set-operations, simply to make life easier for the users.

> PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR
> --------------------------------------------------------------------------------------------------
>
>          Key: DERBY-773
>          URL: http://issues.apache.org/jira/browse/DERBY-773
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.1.2.1
>  Environment: Windows XP
> Java 1.5
> Derby in Embedded or Network mode
>     Reporter: Thomas Dudziak

>
> When using 
>     PreparedStatement ps = ...
>     Character value = ...
>     ps.setObject(0, value, Types.CHAR);
> or
>     ps.setObject(0, value, Types.VARCHAR);
> Derby complains with
>     "An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.lang.Character'."
> Currently a workaround with
>     ps.setObject(0, value.toString(), Types.CHAR);
> is necessary.

-- 
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


[jira] Commented: (DERBY-773) PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR

Posted by "Thomas Dudziak (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-773?page=comments#action_12360752 ] 

Thomas Dudziak commented on DERBY-773:
--------------------------------------

Ok, I won't press you any further. But you are probably aware of the flaw in that argumentation. Users stay with databases for their features, not the easiness of converting to other databases. Not to mention that most other databases are able to do more than what the JDBC spec says they have to do at the least in order to be compliant.

> PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR
> --------------------------------------------------------------------------------------------------
>
>          Key: DERBY-773
>          URL: http://issues.apache.org/jira/browse/DERBY-773
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.1.2.1
>  Environment: Windows XP
> Java 1.5
> Derby in Embedded or Network mode
>     Reporter: Thomas Dudziak

>
> When using 
>     PreparedStatement ps = ...
>     Character value = ...
>     ps.setObject(0, value, Types.CHAR);
> or
>     ps.setObject(0, value, Types.VARCHAR);
> Derby complains with
>     "An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.lang.Character'."
> Currently a workaround with
>     ps.setObject(0, value.toString(), Types.CHAR);
> is necessary.

-- 
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


[jira] Commented: (DERBY-773) PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
    [ http://issues.apache.org/jira/browse/DERBY-773?page=comments#action_12360751 ] 

Daniel John Debrunner commented on DERBY-773:
---------------------------------------------

Derby's charter is to follow standards to allow portability of database applications to migrate to other databases. If Derby provides non-standard extensions to JDBC then applications using them will be locked into Derby.

> PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR
> --------------------------------------------------------------------------------------------------
>
>          Key: DERBY-773
>          URL: http://issues.apache.org/jira/browse/DERBY-773
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.1.2.1
>  Environment: Windows XP
> Java 1.5
> Derby in Embedded or Network mode
>     Reporter: Thomas Dudziak

>
> When using 
>     PreparedStatement ps = ...
>     Character value = ...
>     ps.setObject(0, value, Types.CHAR);
> or
>     ps.setObject(0, value, Types.VARCHAR);
> Derby complains with
>     "An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.lang.Character'."
> Currently a workaround with
>     ps.setObject(0, value.toString(), Types.CHAR);
> is necessary.

-- 
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


[jira] Resolved: (DERBY-773) PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR

Posted by "Daniel John Debrunner (JIRA)" <de...@db.apache.org>.
     [ http://issues.apache.org/jira/browse/DERBY-773?page=all ]
     
Daniel John Debrunner resolved DERBY-773:
-----------------------------------------

    Resolution: Invalid

JDBC does not define any mapping for java.lang.Character.

> PreparedStatement doesn't like Character objects when using setObject with jdbc types CHAR/VARCHAR
> --------------------------------------------------------------------------------------------------
>
>          Key: DERBY-773
>          URL: http://issues.apache.org/jira/browse/DERBY-773
>      Project: Derby
>         Type: Bug
>   Components: JDBC
>     Versions: 10.1.2.1
>  Environment: Windows XP
> Java 1.5
> Derby in Embedded or Network mode
>     Reporter: Thomas Dudziak

>
> When using 
>     PreparedStatement ps = ...
>     Character value = ...
>     ps.setObject(0, value, Types.CHAR);
> or
>     ps.setObject(0, value, Types.VARCHAR);
> Derby complains with
>     "An attempt was made to get a data value of type 'VARCHAR' from a data value of type 'java.lang.Character'."
> Currently a workaround with
>     ps.setObject(0, value.toString(), Types.CHAR);
> is necessary.

-- 
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