This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the
database server (MS SQL 2000), where do you build the connection string?
The obvious answer is to hard code it into the middle layer and use a config
file.
The problem is the database application needs to be distributed to
purchasing clients. Therefore, you do not know, at development, what the SQL
Server is going to be called or what name they want to give the database.
My solution has been to ask for the server and database name at installation
of the client (gui) part. Strictly speaking, the client layer should not
have to know this.
Any one got the correct approach ?
I have looked through several books, but the text refers to in-house db
apps.
Regards H 6 2018
Actually, I think that the client is the correct place to put this
information, in my opinion. The client should read the connection string
from the app.config (or some other storage area) and pass that information
to the objects that it controls. For instance, the client might initialize
some object that ends up doing most of the database work. In that case,
maybe just pass the connection string into the constructor.
My philosophy is to have all configurable parameters as close to the client
as possible and that makes the others tiers more flexible in that all you do
is pass the setting and the tiers do not have to worry about a specific
location for those settings.
"H" <H@HOME.CO.UK> wrote in message
news:cp**********@titan.btinternet.com... This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection string?
The obvious answer is to hard code it into the middle layer and use a
config file.
The problem is the database application needs to be distributed to purchasing clients. Therefore, you do not know, at development, what the
SQL Server is going to be called or what name they want to give the database.
My solution has been to ask for the server and database name at
installation of the client (gui) part. Strictly speaking, the client layer should not have to know this.
Any one got the correct approach ?
I have looked through several books, but the text refers to in-house db apps.
Regards H
Peter
that's been roughly my philosophy. However, does it still work if the Users
(for reasons known only to them) would change the server name.
If you have a few workstations on a LAN, it's not a problem to change the
settings. What if its many workstations on a WAN?
Is it worth the overhead of re-installation for this sort of change?
Regards
H
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:ux**************@TK2MSFTNGP14.phx.gbl... Actually, I think that the client is the correct place to put this information, in my opinion. The client should read the connection string from the app.config (or some other storage area) and pass that information to the objects that it controls. For instance, the client might initialize some object that ends up doing most of the database work. In that case, maybe just pass the connection string into the constructor.
My philosophy is to have all configurable parameters as close to the client as possible and that makes the others tiers more flexible in that all you do is pass the setting and the tiers do not have to worry about a specific location for those settings.
"H" <H@HOME.CO.UK> wrote in message news:cp**********@titan.btinternet.com... This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection string?
The obvious answer is to hard code it into the middle layer and use a config file.
The problem is the database application needs to be distributed to purchasing clients. Therefore, you do not know, at development, what the SQL Server is going to be called or what name they want to give the database.
My solution has been to ask for the server and database name at installation of the client (gui) part. Strictly speaking, the client layer should not have to know this.
Any one got the correct approach ?
I have looked through several books, but the text refers to in-house db apps.
Regards H
not so hard to fix... have the installer start a small config utility (you
may already have this). The config utility will check your web site (web
service) for a list of the server names that are valid. You can even take
the user's login name and pass it to a web service, and thus get the one
name they are supposed to use by looking it up in a database at your end.
The configurator passes the settings to the local machine's config file. If
you ask the user at all, you present him or her with a list of valid values
and you don't let them enter an invalid one.
This gives you some control over configuration.
The only thing that you hardcode: the URL of your web service.
--- Nick
"H" <H@HOME.CO.UK> wrote in message
news:cp**********@titan.btinternet.com... Peter
that's been roughly my philosophy. However, does it still work if the
Users (for reasons known only to them) would change the server name.
If you have a few workstations on a LAN, it's not a problem to change the settings. What if its many workstations on a WAN?
Is it worth the overhead of re-installation for this sort of change?
Regards
H "Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:ux**************@TK2MSFTNGP14.phx.gbl... Actually, I think that the client is the correct place to put this information, in my opinion. The client should read the connection
string from the app.config (or some other storage area) and pass that
information to the objects that it controls. For instance, the client might initialize some object that ends up doing most of the database work. In that case, maybe just pass the connection string into the constructor.
My philosophy is to have all configurable parameters as close to the client as possible and that makes the others tiers more flexible in that all
you do is pass the setting and the tiers do not have to worry about a specific location for those settings.
"H" <H@HOME.CO.UK> wrote in message news:cp**********@titan.btinternet.com... This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the database server (MS SQL 2000), where do you build the connection
string? The obvious answer is to hard code it into the middle layer and use a config file.
The problem is the database application needs to be distributed to purchasing clients. Therefore, you do not know, at development, what
the SQL Server is going to be called or what name they want to give the
database. My solution has been to ask for the server and database name at installation of the client (gui) part. Strictly speaking, the client layer should
not have to know this.
Any one got the correct approach ?
I have looked through several books, but the text refers to in-house db apps.
Regards H
I know that I am splitting hairs here, but, the client still needs to have a
value or a list of values that represents the valid server names to use.
Also, your assuming that the name of the web service remains unchanged.
However, with this scenario why not have the web service build the
connection string? Esp. if the Web Service and SQL Server are on the same
box.
H
"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message
news:wu_td.539818$D%.465092@attbi_s51... not so hard to fix... have the installer start a small config utility (you may already have this). The config utility will check your web site (web service) for a list of the server names that are valid. You can even take the user's login name and pass it to a web service, and thus get the one name they are supposed to use by looking it up in a database at your end. The configurator passes the settings to the local machine's config file. If you ask the user at all, you present him or her with a list of valid values and you don't let them enter an invalid one.
This gives you some control over configuration. The only thing that you hardcode: the URL of your web service.
--- Nick
"H" <H@HOME.CO.UK> wrote in message news:cp**********@titan.btinternet.com... Peter
that's been roughly my philosophy. However, does it still work if the Users (for reasons known only to them) would change the server name.
If you have a few workstations on a LAN, it's not a problem to change the settings. What if its many workstations on a WAN?
Is it worth the overhead of re-installation for this sort of change?
Regards
H "Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:ux**************@TK2MSFTNGP14.phx.gbl... > Actually, I think that the client is the correct place to put this > information, in my opinion. The client should read the connection string > from the app.config (or some other storage area) and pass that information > to the objects that it controls. For instance, the client might > initialize > some object that ends up doing most of the database work. In that > case, > maybe just pass the connection string into the constructor. > > My philosophy is to have all configurable parameters as close to the > client > as possible and that makes the others tiers more flexible in that all you > do > is pass the setting and the tiers do not have to worry about a specific > location for those settings. > > "H" <H@HOME.CO.UK> wrote in message > news:cp**********@titan.btinternet.com... >> This is a question that has haunted me for quite some time. >> >> if you build a 4 tier database application where the 4th tier is the >> database server (MS SQL 2000), where do you build the connection string? >> >> The obvious answer is to hard code it into the middle layer and use a > config >> file. >> >> The problem is the database application needs to be distributed to >> purchasing clients. Therefore, you do not know, at development, what the > SQL >> Server is going to be called or what name they want to give the database. >> >> My solution has been to ask for the server and database name at > installation >> of the client (gui) part. Strictly speaking, the client layer should not >> have to know this. >> >> Any one got the correct approach ? >> >> I have looked through several books, but the text refers to in-house >> db >> apps. >> >> Regards H >> >> > >
The client gets the list of valid server names from the web service.
Yes, I am assuming that the name of the web service remains unchanged.
That's the beauty of DNS. Give it a name in DNS and you don't ever have to
worry about where the server lives.
It is fine to have the web service build the connection string, as long as
the user doesn't have to choose more than one server name. If you can go
from the user id to the correct server name, without end-user input, all the
better.
--- Nick
"H" <H@HOME.CO.UK> wrote in message
news:cp**********@sparta.btinternet.com... I know that I am splitting hairs here, but, the client still needs to have
a value or a list of values that represents the valid server names to use. Also, your assuming that the name of the web service remains unchanged.
However, with this scenario why not have the web service build the connection string? Esp. if the Web Service and SQL Server are on the same box.
H
"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message news:wu_td.539818$D%.465092@attbi_s51... not so hard to fix... have the installer start a small config utility
(you may already have this). The config utility will check your web site
(web service) for a list of the server names that are valid. You can even
take the user's login name and pass it to a web service, and thus get the one name they are supposed to use by looking it up in a database at your
end. The configurator passes the settings to the local machine's config file. If you ask the user at all, you present him or her with a list of valid values and you don't let them enter an invalid one.
This gives you some control over configuration. The only thing that you hardcode: the URL of your web service.
--- Nick
"H" <H@HOME.CO.UK> wrote in message news:cp**********@titan.btinternet.com... Peter
that's been roughly my philosophy. However, does it still work if the Users (for reasons known only to them) would change the server name.
If you have a few workstations on a LAN, it's not a problem to change
the settings. What if its many workstations on a WAN?
Is it worth the overhead of re-installation for this sort of change?
Regards
H "Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:ux**************@TK2MSFTNGP14.phx.gbl... > Actually, I think that the client is the correct place to put this > information, in my opinion. The client should read the connection string > from the app.config (or some other storage area) and pass that information > to the objects that it controls. For instance, the client might > initialize > some object that ends up doing most of the database work. In that > case, > maybe just pass the connection string into the constructor. > > My philosophy is to have all configurable parameters as close to the > client > as possible and that makes the others tiers more flexible in that all you > do > is pass the setting and the tiers do not have to worry about a
specific > location for those settings. > > "H" <H@HOME.CO.UK> wrote in message > news:cp**********@titan.btinternet.com... >> This is a question that has haunted me for quite some time. >> >> if you build a 4 tier database application where the 4th tier is the >> database server (MS SQL 2000), where do you build the connection string? >> >> The obvious answer is to hard code it into the middle layer and use
a > config >> file. >> >> The problem is the database application needs to be distributed to >> purchasing clients. Therefore, you do not know, at development, what the > SQL >> Server is going to be called or what name they want to give the database. >> >> My solution has been to ask for the server and database name at > installation >> of the client (gui) part. Strictly speaking, the client layer should not >> have to know this. >> >> Any one got the correct approach ? >> >> I have looked through several books, but the text refers to in-house >> db >> apps. >> >> Regards H >> >> > >
The Configuration Management Application Block is probably worth a look
also. http://www.microsoft.com/downloads/d...5cb1c53-8ca7-4
a92-85e3-e4795bd27feb&displaylang=en
Andrew McNerlin
Internet Solutions (Ireland) http://www.isoli.co.uk
-----Original Message-----
From: Nick Malik [mailto:ni*******@hotmail.nospam.com]
Posted At: 10 December 2004 08:38
Posted To: microsoft.public.dotnet.general
Conversation: Which layer do you build the connection string?
Subject: Re: Which layer do you build the connection string?
The client gets the list of valid server names from the web service.
Yes, I am assuming that the name of the web service remains unchanged.
That's the beauty of DNS. Give it a name in DNS and you don't ever have
to
worry about where the server lives.
It is fine to have the web service build the connection string, as long
as
the user doesn't have to choose more than one server name. If you can
go
from the user id to the correct server name, without end-user input, all
the
better.
--- Nick
"H" <H@HOME.CO.UK> wrote in message
news:cp**********@sparta.btinternet.com... I know that I am splitting hairs here, but, the client still needs to
have
a value or a list of values that represents the valid server names to
use. Also, your assuming that the name of the web service remains
unchanged. However, with this scenario why not have the web service build the connection string? Esp. if the Web Service and SQL Server are on the
same box.
H
"Nick Malik" <ni*******@hotmail.nospam.com> wrote in message news:wu_td.539818$D%.465092@attbi_s51... not so hard to fix... have the installer start a small config
utility
(you may already have this). The config utility will check your web site
(web service) for a list of the server names that are valid. You can
even
take the user's login name and pass it to a web service, and thus get the
one name they are supposed to use by looking it up in a database at your
end. The configurator passes the settings to the local machine's config
file. If you ask the user at all, you present him or her with a list of valid values and you don't let them enter an invalid one.
This gives you some control over configuration. The only thing that you hardcode: the URL of your web service.
--- Nick
"H" <H@HOME.CO.UK> wrote in message news:cp**********@titan.btinternet.com... Peter
that's been roughly my philosophy. However, does it still work if
the Users (for reasons known only to them) would change the server name.
If you have a few workstations on a LAN, it's not a problem to
change
the settings. What if its many workstations on a WAN?
Is it worth the overhead of re-installation for this sort of
change? Regards
H "Peter Rilling" <pe***@nospam.rilling.net> wrote in message news:ux**************@TK2MSFTNGP14.phx.gbl... > Actually, I think that the client is the correct place to put
this > information, in my opinion. The client should read the
connection string > from the app.config (or some other storage area) and pass that information > to the objects that it controls. For instance, the client might > initialize > some object that ends up doing most of the database work. In
that > case, > maybe just pass the connection string into the constructor. > > My philosophy is to have all configurable parameters as close to
the > client > as possible and that makes the others tiers more flexible in that
all you > do > is pass the setting and the tiers do not have to worry about a
specific > location for those settings. > > "H" <H@HOME.CO.UK> wrote in message > news:cp**********@titan.btinternet.com... >> This is a question that has haunted me for quite some time. >> >> if you build a 4 tier database application where the 4th tier is
the >> database server (MS SQL 2000), where do you build the connection string? >> >> The obvious answer is to hard code it into the middle layer and
use
a > config >> file. >> >> The problem is the database application needs to be distributed
to >> purchasing clients. Therefore, you do not know, at development,
what the > SQL >> Server is going to be called or what name they want to give the database. >> >> My solution has been to ask for the server and database name at > installation >> of the client (gui) part. Strictly speaking, the client layer
should not >> have to know this. >> >> Any one got the correct approach ? >> >> I have looked through several books, but the text refers to
in-house >> db >> apps. >> >> Regards H >> >> > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: james |
last post by:
I have written a generalised database access component which construct
the connection string after decrypting its value using DPAPI
methodology.
...
|
by: Varun |
last post by:
I have a solution which contains windows,web,mobile presentations. Now i want to share the connection string in the web.config file.
i want to...
|
by: Steph. |
last post by:
Hi,
How can I display to the user the "Connection String Dialog" (The Dialog to build connection string) in my application ?
Thanks,
...
|
by: Jeff |
last post by:
I have a main project which references several DLLs. Each DLL will
access the same database as the main project. I'm storing the
connection...
|
by: NALINI |
last post by:
Hi ,
In my project i'm having an xml file which is having connection
string(for sql server).I included some reports in that project .How should i...
|
by: H |
last post by:
This is a question that has haunted me for quite some time.
if you build a 4 tier database application where the 4th tier is the
database server...
|
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...
|
by: alingsjtu |
last post by:
What's the DB2 connection string wihout DSN when use IBM DB2 OLE
PROVIDER in windows environment, such as ADO or Creation of Linked
Server in MS...
|
by: GR M |
last post by:
HI,
What my Idea is to develop a class which will create connection string depending upon the version of the database, i.e Office2007 or...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |