3

I need to turn on Multiple Active Result Sets for an ODBC data source, but I can not figure out how to set it.

And the end of the wizard I see this in the configuration summary:

Multiple Active Result Sets(MARS): No

mikerobi
  • 133
  • 1
  • 1
  • 3

2 Answers2

5

It's best to enable MARS in an app's connection string when that app is specifically designed to make use of this feature.

That said, you can edit the registry entry for the DSN after you've created it:

\HKLM\Software\ODBC\ODBC.INI\MyDSN

Add a string value:

Name - MARS_Connection
Value - Yes

You need to be VERY careful about doing this, though. If an app is not designed to use MARS then this will break the app if it's using the DSN.

squillman
  • 37,618
  • 10
  • 90
  • 145
  • Thank you, I could not get it working through the connection string. Is it supposed to be `MultipleActiveResultSets=true`? Maybe it is unsupported by my ODBC driver (pyodbc)? – mikerobi Aug 17 '11 at 17:19
  • Probably not. From everything I know you need the SQL Native Client to use MARS. – squillman Aug 17 '11 at 17:29
  • I don't understand your comment. I am using the SQL Native Client via ODBC, my app works when I change the registry key. – mikerobi Aug 17 '11 at 17:49
1

Create a batch file using below line or execute below line on CMD prompt. This will modify your existing DSN for MARS_ENABLE=Yes.

odbcconf /a {CONFIGSYSDSN "XXX" "DSN=YYY|MARS_Connection=YES"}

Please Note: *Replace XXX with your ODBC Driver (In my case it was SQL Server Native Client 10.0) *Replace YYY with your DSN Name (In my case it was MYTESTDSN) *After running the command (via script or on cmd prompt), verify the result with checking your existing DSN via. configure option.

EightBitTony
  • 9,211
  • 1
  • 32
  • 46
Mohan
  • 11
  • 1