Skip to content Skip to sidebar Skip to footer

Turning On Multiple Result Sets In An Odbc Connection To Sql Server

I have an application that originally needed to connect to Sybase (via ODBC), but I've needed to add the ability to connect to SQL Server as well. As ODBC should be able to handle

Solution 1:

According to the SNI documentation on Using Multiple Active Result Sets (MARS):

The SQL Server Native Client ODBC driver supports MARS through additions to the SQLSetConnectAttr and SQLGetConnectAttr functions. SQL_COPT_SS_MARS_ENABLED has been added to accept either SQL_MARS_ENABLED_YES or SQL_MARS_ENABLED_NO, with SQL_MARS_ENABLED_NO being the default. In addition, a new connection string keyword, Mars_Connection, as been added. It accepts "yes" or "no" values; "no" is the default.

Make sure your client loads the right drivers, use Mars_Connection=yes, and validate in the app by checking SQL_COPT_SS_MARS_ENABLED on SQLGetConnectAttr.

Post a Comment for "Turning On Multiple Result Sets In An Odbc Connection To Sql Server"