Skip to content

CallableStatement.getString() returns incorrect string value for uniqueidentifier #405

@xiangyushawn

Description

@xiangyushawn

When parameter type is uniqueidentifier, calling the following works fine.

callableStatement.registerOutParameter(1, java.sql.Types.CHAR);
callableStatement.setObject(1, uuid.toString(), java.sql.Types.CHAR);
then
CallableStatement.getString()

Calling the following returns incorrect string value.

callableStatement.registerOutParameter(1, microsoft.sql.Types.GUID);
callableStatement.setObject(1, uuid.toString(), microsoft.sql.Types.GUID);
then
CallableStatement.getString()

For example:

the original Java UUID object: dc0126da-0698-47d2-bd02-e47ae44b118a
callableStatement.getObject(): DC0026DA-0698-47D2-BD02-E47AE44B118A
callableStatement.getString(): DA2600DC9806D247BD02E47AE44B118A

The repro code is attached.
try_callableStatement_getObject_uniqueidentifier.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions