none
SQl Server 2014: MARS Enabled. Can Get multiple result sets when using SQL Native Client 11.0 but NOT with SQL Server RRS feed

  • Question

  • Hi,

    I hope this is the correct forum to post this.  I did not see any similar questions.

    I am running old C++ code built in VS2017.  Currently we are using SQL Native Client 11.0 with MARS turned on in 

    SQLSetConnectAttr(m_hdbc, SQL_COPT_SS_MARS_ENABLED, (SQLPOINTER)SQL_MARS_ENABLED_YES, SQL_IS_UINTEGER);

    This works fine.  We now want to switch from SQL Native Client 11. 0 to SQL Server because we find it is faster on the cloud.  When I try to run (with the exact same code) using SQL Server,  I always get the exception "connection is busy with results from another hstmt".

    Any ideas?  

    Thanks in advance for your help!

    Alex


    A Enterline

    Monday, June 17, 2019 4:24 PM

Answers

  • Thank you for your response.  Yes, I had been using the old version of the driver.  Yesterday I installed 17 and now everything works perfectly.  

    Thanks!

    Alex


    A Enterline

    Wednesday, June 19, 2019 10:43 AM

All replies

  • Hi Alex,

    Thanks for your post.

    Based on my research, Multiple Active Result Sets belongs to the feature of SQL Native Client, not SQL Server. I haven't seen some related articles about this feature under SQL Server driver. Maybe it is the old driver.

    Reference

    Using Multiple Active Result Sets (MARS)

    Best Regards,

    Will


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 18, 2019 3:33 AM
    Moderator
  • Hi Will,

    Thank you for your quick response.  Yes, I agree, I have been investigating and I too believe it is only available in Native Client. I was hoping that was not the case.

    Thanks,

    Alex


    A Enterline

    Tuesday, June 18, 2019 10:35 AM
  • Do you by "SQL Server" mean the ODBC driver that comes with the OS and which is 20 years old? No, that driver does not support MARS, and nor does it support lot of other features that were added in SQL 2005 or later. Simply put: don't use that driver. You should use the ODBC 17 SQL Driver. (SQL Server Native Client 11.0 is quite old too.)

    By the way, if you are concerned with speed when communicating with the cloud, you should not run with MARS enabled. Having MARS enabled when you retrieve large result could easily increase response time by a factor of ten in network overhead.


    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

    Tuesday, June 18, 2019 9:50 PM
  • Thank you for your response.  Yes, I had been using the old version of the driver.  Yesterday I installed 17 and now everything works perfectly.  

    Thanks!

    Alex


    A Enterline

    Wednesday, June 19, 2019 10:43 AM