Skip to content

sqlserver database error #2311

@yangyuditest

Description

@yangyuditest

Describe the bug

When using SQL Server, the JdbcOAuth2AuthorizationService throws an error:
"The string is not in a valid hex format"

Root Cause

SQL Server does NOT support BLOB type (2004).
It only supports VARBINARY(MAX) which maps to JDBC type -3 (Types.VARBINARY).

But in the mapping code:

(Types.BLOB == columnMetadata.getDataType()

It only checks for BLOB(2004), not VARBINARY(-3).
So SQL Server binary fields get STRING values instead of byte[] → hex format error.
Expected behavior
The framework should support SQL Server by checking Types.VARBINARY(-3) in addition to Types.BLOB(2004).
Fix code suggestion
Change:
Types.BLOBTypes.VARBINARY
Or support both:
(Types.BLOB == type || Types.VARBINARY == type)
Environment
Spring Authorization Server version: 1.5.6   spring-security-oauth2-authorization-server
Database: SQL Server
Table schema: VARBINARY(MAX) for token fields
Error message: The string is not in a valid hex format

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions