|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Connection String QuestionHello, friends,
We have a connection string in our .net app configuration file like the follows: "packet size=4096;data source=server349;persist security info=False;initial catalog=universalDB;user=everyone;password=everyone;" Since each server has its own database instance, each time we deploy app to a new server, we have to modify connection string: changing data source name, say, from server349 to server712 Can we have a connection string that we don't have to modify connection string each time deploying to a new server? What is syntax? Thank you for your help. Well, the answer is two fold
a) Yes - you can change the connection string to say (local) instead of (server349), or any other such trick. b) The connex. string should be in the config file anyway, so changing it shouldn't be a big deal. - Sahil Malik [MVP] ADO.NET 2.0 book - http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx ---------------------------------------------------------------------------- Show quote "Andrew" <And***@discussions.microsoft.com> wrote in message news:8733137B-92A3-43EB-85D4-1F58468553B9@microsoft.com... > Hello, friends, > > We have a connection string in our .net app configuration file like the > follows: > > "packet size=4096;data source=server349;persist security > info=False;initial > catalog=universalDB;user=everyone;password=everyone;" > > Since each server has its own database instance, each time we deploy app > to > a new server, we have to modify connection string: changing data source > name, > say, from server349 to server712 > > Can we have a connection string that we don't have to modify connection > string each time deploying to a new server? What is syntax? > > Thank you for your help. Thank you. I will change data source=server349 to data source=local
The reason why this is important to us is because sometimes people forgot to change this parameter, and caused big problem since all data were updated in the WRONG server. Show quote "Sahil Malik [MVP C#]" wrote: > Well, the answer is two fold > > a) Yes - you can change the connection string to say (local) instead of > (server349), or any other such trick. > b) The connex. string should be in the config file anyway, so changing it > shouldn't be a big deal. > > > - Sahil Malik [MVP] > ADO.NET 2.0 book - > http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx > ---------------------------------------------------------------------------- > > > "Andrew" <And***@discussions.microsoft.com> wrote in message > news:8733137B-92A3-43EB-85D4-1F58468553B9@microsoft.com... > > Hello, friends, > > > > We have a connection string in our .net app configuration file like the > > follows: > > > > "packet size=4096;data source=server349;persist security > > info=False;initial > > catalog=universalDB;user=everyone;password=everyone;" > > > > Since each server has its own database instance, each time we deploy app > > to > > a new server, we have to modify connection string: changing data source > > name, > > say, from server349 to server712 > > > > Can we have a connection string that we don't have to modify connection > > string each time deploying to a new server? What is syntax? > > > > Thank you for your help. > > > change it to local did not work???
Show quote "Sahil Malik [MVP C#]" wrote: > Well, the answer is two fold > > a) Yes - you can change the connection string to say (local) instead of > (server349), or any other such trick. > b) The connex. string should be in the config file anyway, so changing it > shouldn't be a big deal. > > > - Sahil Malik [MVP] > ADO.NET 2.0 book - > http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx > ---------------------------------------------------------------------------- > > > "Andrew" <And***@discussions.microsoft.com> wrote in message > news:8733137B-92A3-43EB-85D4-1F58468553B9@microsoft.com... > > Hello, friends, > > > > We have a connection string in our .net app configuration file like the > > follows: > > > > "packet size=4096;data source=server349;persist security > > info=False;initial > > catalog=universalDB;user=everyone;password=everyone;" > > > > Since each server has its own database instance, each time we deploy app > > to > > a new server, we have to modify connection string: changing data source > > name, > > say, from server349 to server712 > > > > Can we have a connection string that we don't have to modify connection > > string each time deploying to a new server? What is syntax? > > > > Thank you for your help. > > > not "local" .. try "(local)" <-- note the parenthesis
or "." or "127.0.0.1" .. anything like that. - Sahil Malik [MVP] ADO.NET 2.0 book - http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx ---------------------------------------------------------------------------- Show quote "Andrew" <And***@discussions.microsoft.com> wrote in message news:2E355238-7AEC-4B30-8E15-C4D76A077EF2@microsoft.com... > change it to local did not work??? > > "Sahil Malik [MVP C#]" wrote: > >> Well, the answer is two fold >> >> a) Yes - you can change the connection string to say (local) instead of >> (server349), or any other such trick. >> b) The connex. string should be in the config file anyway, so changing it >> shouldn't be a big deal. >> >> >> - Sahil Malik [MVP] >> ADO.NET 2.0 book - >> http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx >> ---------------------------------------------------------------------------- >> >> >> "Andrew" <And***@discussions.microsoft.com> wrote in message >> news:8733137B-92A3-43EB-85D4-1F58468553B9@microsoft.com... >> > Hello, friends, >> > >> > We have a connection string in our .net app configuration file like the >> > follows: >> > >> > "packet size=4096;data source=server349;persist security >> > info=False;initial >> > catalog=universalDB;user=everyone;password=everyone;" >> > >> > Since each server has its own database instance, each time we deploy >> > app >> > to >> > a new server, we have to modify connection string: changing data source >> > name, >> > say, from server349 to server712 >> > >> > Can we have a connection string that we don't have to modify connection >> > string each time deploying to a new server? What is syntax? >> > >> > Thank you for your help. >> >> >> |
|||||||||||||||||||||||