• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 517
  • Last Modified:

Mirrored SQL connection string

Hi Experts

i have an asp application running under ASP/SQL
my connection string i asp file is
Connection.Open "DRIVER={SQL Server}; Server=" & varServerIP & "; Database=" & varDataBaseName & "; UID=" & varUserName & "; PWD=" & varPassword'

I am migration now my db to a mirrored plateforme with three sql servers
sMaster, slave and mirror

how to modify my connection string
i have seen on ee formums a connection string like this
Data Source=myServerAddress;Failover Partner=myMirrorServer;Initial
Catalog=myDataBase;Integrated Security=True;

But i dont know how to adapt my connection string to the new one
please advise
  • 5
  • 5
1 Solution
Guy Hengel [angelIII / a3]Billing EngineerCommented:
please read this article:

it contains also sample code.
note that the only part you have to add to your connection string is the Failover Partner.
humer2000Author Commented:
i already read it this morning and it did not give me any examples
i am a beginner in this :)
Guy Hengel [angelIII / a3]Billing EngineerCommented:
I repeat:
the only part you have to add to your connection string is the Failover Partner stuff.
in the article they mention that depending on what technology you use, it might be with space or underscore ...
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

humer2000Author Commented:
i have added the code and i am getting error
Microsoft OLE DB Service Components error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/shop$dbconnect.asp, line 166

My connection is the following

Connection.Open "Driver={SQL Native Client}; "          &_
      "Server="       & varServerIP  & ";"      &_
      "Database=" & varDataBaseName              & ";"      &_
      "Uid="             & varUserName      & ";"      &_
      "Pwd="             & varPassword       & ";"      &_
      "Data Source="       & varServerIP       & ";"      &_
      "Failover Partner=xx.xx.xx.xxx;"                                                &_
      "Initial Catalog=" & varDataBaseName                            & ";"      &_
      "Integrated Security=True;"
Guy Hengel [angelIII / a3]Billing EngineerCommented:
unfortunately, I have no means to set up the same environment to test :(

however, with Sql Native Client:

Connection.Open "Driver={SQL Native Client}; "          &_
      "Server="       & varServerIP  & ";"      &_
      "Database=" & varDataBaseName              & ";"      &_
      "Uid="             & varUserName      & ";"      &_
      "Pwd="             & varPassword       & ";"      &_
      "Data Source="       & varServerIP       & ";"      &_
      "FailoverPartner=xx.xx.xx.xxx;"                                                &_
      "Initial Catalog=" & varDataBaseName                            & ";"      &_
      "Integrated Security=True;"

Open in new window

humer2000Author Commented:
lol, it's the same code as mine !  anyway i copy/pasted the code
same error :(

Guy Hengel [angelIII / a3]Billing EngineerCommented:
it's not the "same" code... there is no space in the Failover Partner :)
anyhow, if it does not work, that does not really matter ...

sorry, but I don't know more about this.
please use the "request attention" link, so a moderator can try to attract more experts to the question.
humer2000Author Commented:
where is the  "request attention" link ??? i dont see it !

i just want to make a note, maybe this will help u,

SQL db is hosted on SQL 2005 Enterprise
ASP application is hosted on another server running Win 2003 Enterprise
humer2000Author Commented:
the correct syntax is the following

Connection.open "Driver={SQL Native Client};Server=" & varServerIP & "; Failover_Partner=; Database=" & varDataBaseName & "; Uid=" & varUserName & "; Pwd=" & varPassword

You should not put Integrated Security=True
If you add this , it won't work

However what's the purpose of Integrated Security=True ?
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>However what's the purpose of Integrated Security=True ?

that will tell the driver to use the currently connected windows account for login to sql server.
however, in web-driven pages this means that unless you are in a intranet site with anonymeous user disabled, it will not be able to use the front-end user windows account, but it uses the asp/iis service startup account.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now