Enabling multiple result sets in an ODBC connection to SQL Server

I have an application that initially needed to connect to Sybase (via ODBC), but I needed to add the ability to connect to SQL Server. Since ODBC should be able to handle both, I thought I was in a good position.

Unfort, SQL Server will not allow me, by default, to install ODBC and ODBCDataReaders commands - it complains that the connection is busy (the connection is busy with the results for another command).

I know that I had to point out that in such cases, when connecting to SQL Server through the native driver, several active result sets (MARS) were allowed, so I thought this was not a problem.

The DSN Wizard does not have y authority when creating a SystemDSN.

Some people provided registry hacks to get around this, but it didn’t work (add MARS_Connection with Yes to HKEY_LOCAL_MACHINE \ SOFTWARE \ ODBC \ ODBC.INI \ system-dsn-name).

Another suggestion was to create a dsn file and add "MARS_Connection = YES" to it. Does not work.

Finally, the DSN-less connection string. I tried this (using MultipleActiveResultSets - use the same variable as the Sql server connection)

"Driver={SQL Native Client};Server=xxx.xxx.xxx.xxx;Database=someDB;Uid=u;Pwd=p;MultipleActiveResultSets=True;"

and this one:

"Driver={SQL Native Client};Server=192.168.75.33\\ARIA;Database=Aria;Uid=sa;Pwd=service;MARS_Connection=YES;"

I checked the various nodes of the connection string - they all offer what I have already tried.

I must indicate that I tried both the SQL Server driver and the native SQL Server driver ...

+3
source share
1 answer

SNI (MARS):

ODBC SQL Server MARS SQLSetConnectAttr SQLGetConnectAttr. SQL_COPT_SS_MARS_ENABLED , SQL_MARS_ENABLED_YES SQL_MARS_ENABLED_NO, SQL_MARS_ENABLED_NO . , , Mars_Connection, . "" "", ; "" - .

, , Mars_Connection=yes , SQL_COPT_SS_MARS_ENABLED SQLGetConnectAttr.

+4

Source: https://habr.com/ru/post/1742533/


All Articles