473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

connection string variable...

We have several applications that use the ".exe.config" .xml file to get
the connection string to our SQL server db. Each user of the application has
their own .xml file because we have some user specific settings in there...

My question is this... We are looking at setting up a backup SQL server. I
would like to modify the .xml config files so that they read the connection
string from a network share instead. That way, we can easily change the
server name in place so that the next time the users run the app, it will be
pointing to the backup server and vice versa.

Does anyone have any ideas how this could be done?

Thanks, Brad
May 30 '07 #1
2 1730

"Brad Pears" <br***@truenorthloghomes.comwrote in message
news:ew**************@TK2MSFTNGP04.phx.gbl...
We have several applications that use the ".exe.config" .xml file to get
the connection string to our SQL server db. Each user of the application
has their own .xml file because we have some user specific settings in
there...

My question is this... We are looking at setting up a backup SQL server.
I would like to modify the .xml config files so that they read the
connection string from a network share instead. That way, we can easily
change the server name in place so that the next time the users run the
app, it will be pointing to the backup server and vice versa.

Does anyone have any ideas how this could be done?
You come-up with a file called connstr.txt and have the connection string in
that file, after all it's just string/text data in a file, whether it's in
an XML file or a non XML text file type.

You create a function that opens that file and reads the string data from
connstr.txt. You can have a path statement in the ".exe.config" .xml
pointing to connstr.txt. Connstr.txt can be out there on a network share.
You're only problem would be if two or more users tried to open Connstr.txt
at the same time.

You may need some code in the function to try again to open the file on some
iteration count, before it indicates it can't open the file. But that's most
likely not going to happen anyway with multiple users trying to open the
file at the same time.

May 30 '07 #2
So would you write the function separate from the app using vb script (a
..vbs file) and somehow call that from the .xml file (if you can) or would
you code this directly into the application - where we are getting the
config settings now? and just string together the server name with the rest
of the connection string?

Thanks, Brad

"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:uW****************@TK2MSFTNGP04.phx.gbl...
>
"Brad Pears" <br***@truenorthloghomes.comwrote in message
news:ew**************@TK2MSFTNGP04.phx.gbl...
>We have several applications that use the ".exe.config" .xml file to get
the connection string to our SQL server db. Each user of the application
has their own .xml file because we have some user specific settings in
there...

My question is this... We are looking at setting up a backup SQL server.
I would like to modify the .xml config files so that they read the
connection string from a network share instead. That way, we can easily
change the server name in place so that the next time the users run the
app, it will be pointing to the backup server and vice versa.

Does anyone have any ideas how this could be done?

You come-up with a file called connstr.txt and have the connection string
in that file, after all it's just string/text data in a file, whether it's
in an XML file or a non XML text file type.

You create a function that opens that file and reads the string data from
connstr.txt. You can have a path statement in the ".exe.config" .xml
pointing to connstr.txt. Connstr.txt can be out there on a network share.
You're only problem would be if two or more users tried to open
Connstr.txt at the same time.

You may need some code in the function to try again to open the file on
some iteration count, before it indicates it can't open the file. But
that's most likely not going to happen anyway with multiple users trying
to open the file at the same time.

May 30 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mrinal Kamboj | last post by:
Hi , I am using OracleConnection object from Oracle ODP.net provider and following is the behaviour which i am finding bit strange : To start with my argument is based on followings facts : ...
37
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
13
by: Jennifer.Berube | last post by:
well I'm not sure how to go about making my SQL connection string... The code below is what I need to replace with my SQL connection...I just don't know if that code is for DSN or access... I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.