[thelist] storing connection strings in application variables

Chris Blessing webguy at mail.rit.edu
Thu Jan 24 09:47:20 CST 2002


Forgive me if this is a rather complicated question.  Just to preface you
I'm running IIS4/NT4 and using ASP/SQL Server.

What I have is a development server and a live server.  Because the machines
are different I have stored the connection string as an application-level
variable (application("connStr")).  Depending on the serverNode application
var (I have this stored in each server's global.asa), this connection string
is setup with a different IP for the data source.  Within the db server
we're using two databases, one called "orders" and one called "products".  I
sometimes need to switch from one to the other depending on the page (like
one page shows our products and one shows your order history, for example)
and some pages end up using both.  I do this by calling a function I wrote
to manipulate the "initial catalog" portion of the connection string and
then opening the connection object as necessary.

Now the issue I face is this:  should I be doing this on an application
variable level?  If one user comes to the site while another user is on the
site and requests an order page at the same time as the other user requests
a product page, wouldn't that cause a "conflic of interest" in updating the
connStr?  One person might get the page they want while the other gets an
error (since the data source wasn't updated and that page explicitly uses
that data source).  If I was to store the connection string in a session
variable that would keep things separate on a user-by-user basis and
eliminate this problem of cross-updating the connection string correct?

Let me know if I can be a bit more vague here. =)  TIA!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net





More information about the thelist mailing list