Is MS ODBC driver 18.5.1.1 compatible with SQL Server 2025 for new JSON and VECTOR types?

Sebastien Flaesch 31 Reputation points
2025-06-12T12:44:51.11+00:00

Hello,

I would like to test the new JSON and VECTOR types of SQL Server 2025 with the Microsoft ODBC driver for SQL Server.

I have installed SQL Server 2025 CTP 2.0 on my Windows 11.

For now I have MS ODBC driver 18.5.1.1 for Linux (Debian 12).

Is this ODBC driver version supporting JSON type, or should I wait for a new release of your ODBC driver?

I get the following problem:

I want for fetch rows with a simple SELECT on a table with a JSON column, without any CAST().

SQLDescribeColumn() returns type information for the JSON column, as if it was a VARCHAR(MAX).

My code is just doing the same as if the source column was a VARCHAR(MAX).

However, at SQLFetchScroll() time, I get the following error:

[Microsoft][ODBC Driver 18 for SQL Server]Unknown token received from SQL Server

I suspect that your ODBC driver 18.5.1.1 is not yet ready to fetch JSON columns...

I also plan to test the new VECTOR type.

Thanks!
Seb

SQL Server Database Engine
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Davide 11 Reputation points Microsoft Employee
    2025-06-12T18:52:21.57+00:00

    Hi Sebastien! Thanks for trying out Vectors and JSON! For what concern vectors, today they are sent to any client as a string, to provide full compatibility with anything.

    https://learn.microsoft.com/en-us/sql/t-sql/data-types/vector-data-type?view=azuresqldb-current&tabs=csharp-sample#compatibility

    We're working to update the TDS protocol (and thus the drivers) to send vectors in a more efficient binary format. Stay tuned in the next months for announcements :)

    2 people found this answer helpful.

  2. Umachandar Jayachandran (UC) 31 Reputation points Microsoft Employee
    2025-06-12T19:05:54.14+00:00

    Hi Sebastien, Thanks for your feedback. Currently, only Microsoft.Data.SqlClient (6.0.2) has support for JSON data type. All other drivers will see the JSON type as either varchar(max) with UTF8 collation or nvarchar(max) with database collation. We are looking at adding support in JDBC driver for JSON data type.

    For ODBC/OLDB, adding support for JSON datatype requires providing API for dealing with JSON documents / parsing. So, we are evaluating what to do here. I would love to hear more about what type of application you are building with JSON and what you plan to do with JSON data in the ODBC app.

    Now, since you are using the new ODBC driver that has support for UTF-8 collation, the driver will currently see the JSON type as varchar(max) column only. Can you provide a repro with the table schema that demonstrates the SQLFetchScroll? Which cursor type are you using or just the default result set? Is the example from below article close to what you are doing? I will try to repro the issue.

    https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/row-wise-binding?view=sql-server-ver17

    2 people found this answer helpful.

  3. Erland Sommarskog 121.3K Reputation points MVP Volunteer Moderator
    2025-06-12T17:22:41.3566667+00:00

    When they add new data types, they typically provide formats that work with downlevel drivers. When it comes to the JSON type, I don't think they never return it to the client as that type, but they always return it as nvarchar(MAX). I don't know why you got varchar(MAX) from SQLDescribeColumn, but it could explain the later error.

    As for vector, I don't how they return that, but vector is really an alias type to varbinary.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.