Wednesday, March 7, 2012

How to set Multiple Active Results Sets (MARS) enable in ODBC

hello all there

can any body tell me how could i set the Multiple Active results Sets (MARS) option on/yes in case of the ODBC.

The thing is i create the connection using the SQL Native(sql sqrver-2005)wizard,

i got following when create the DNS

Microsoft SQL Native Client Version 09.00.1399

Data Source Name: DM_N
Data Source Description:
Server: vsnet1
Use Integrated Security: No
Database: DM
Language: (Default)
Data Encryption: No
Trust Server Certificate: No
Multiple Active Result Sets(MARS): No
Mirror Server:
Translate Character Data: Yes
Log Long Running Queries: No
Log Driver Statistics: No
Use Regional Settings: No
Use ANSI Quoted Identifiers: Yes
Use ANSI Null, Paddings and Warnings: Yes

i just want to set the

Multiple Active Result Sets(MARS): YES

how could i ?

any help, solution or hint

Regards

Thanks

Gurpreet S. Gill

use this within your SQL Server connectionstring:

"Driver={SQL Native Client};Server=Aron1;Database=pubs;Trusted_Connection=yes;MARS_Connection=yes"

HTH, jens Suessmeyer.

http://www.sqlserver2005.de|||

Thanks HTH

but the problem is that i dont want to configure it using connection string as HTH said.

i want to Configure it from using SQL Native wizard(ODBC) itself

as i cant touch the application code...

So i just want to have the DNS with

Multiple Active Result Sets(MARS): YES

or any other idea?

Thanks

Regard

Gurpreet S. Gill

|||

There was a lot of careful thought that went into the decision not to expose MARS in the DSN Wizard setttings. MARS is only useful in the case of an application specifically designed to use MARS, and turning MARS on for an application not explicitly designed for it will either provide no utility or in the worst case may cause the application to work incorrectly. Given that, it made sense to require the developer to be present to make the application changes needed to work correctly with MARS, in which case they can use the connection string to turn MARS on.

One way around this might be to use a FileDSN. By creating a FileDSN and manually adding the MARS_Connection keyword you should be able to connect using MARS. But I would exercise caution and make sure the application is well tested for that case.

|||

Hi i set the File DSN as

[ODBC]
DRIVER=SQL Native Client
UID=sa
DATABASE=DM
WSID=VSNET5
APP=Microsoft Data Access Components
SERVER=VSNET1
MARS_Connection=YES

but still it doesnt make MARS enables connection, our appliction still gives error "Connection Busy...."

Any other hint or solution?

regards,

Gurpreet S. Gill

|||

Add this before you call SQLDriverConnect

SQLSetConnectAttr(hdbc, SQL_COPT_SS_MARS_ENABLED, SQL_MARS_ENABLED_YES, SQL_IS_UINTEGER);

|||

If you need to use MARS, you need to set the connection attribute in your application explicitly. It is not possible to enable it in DSN.

This is because that MARS is only useful if an application acutally uses the functionality provided by MARS. In this case, it should not be a problem for the application to set the MARS attribute in code.

It sounds weird to me an application uses MARS but connects to database without enabling it...

|||Where could i write this

SQLSetConnectAttr(hdbc, SQL_COPT_SS_MARS_ENABLED, SQL_MARS_ENABLED_YES, SQL_IS_UINTEGER);

?

No comments:

Post a Comment