Hello everyone. This is my first time posting anything so here goes. I am really new to asp classic. I use
vb script as the scripting language. My task is to make the database connection string portable. So no matter WHICH machine the database is sitting on, the connection string will follow. Now each possible server is represented by the IP's address.
I was able to learn the code to determine the IP address and if the IP address is true then the connection string is loaded into the varibale. However in the actual site, everything refers back to a global connction string.
Therefore I am changing this in the 'constants' page. Basically the connection string has been globalized. However the strings will change depending on which IP's address is true.
Here is the code that I am currently working with:
I was thinking of making the Const MCCI Constring a variable that is set by the conditional statements. I am unsure how to do this because I do not know how to assgin an varible to a constant. Please help if you can.
{I had to change some data and connection strings, do not worry about the consistency of the connection string}
<%
'Declaring Variables
Dim IP
Dim Rs
Dim Conn
Dim pc
IP = Request("LOCAL_ADDR")
Set pc = nothing
Response.write Request.ServerVariables("LOCAL_ADDR")
If (IP = "127.0.0.1") then
'Open ODBC Source
const MCCIConnectionString = "Provider=sqloledb; server=MDD-MPERRY-S; database=MDD; uid=bisSA;pwd=cuberacle;"
'IP Address for MD-INT-DEV-02
'If (IP = "172.16.28.141") then
'MDConnectionString = "Provider=sqloledb; server=Mdd-INT-dev-02; database=Mtti; uid=sa;pwd=cuberac;e;"
'IP Address for Production Site
'If (IP = "172.16.32.56") then
'cn.Open MdConnectionString
Else
'Error Message when the IP address has not been added
response.write("<h3><b>Please add the ip address of the server to the this page to work</b></h3>")
End If
%>
<%
'The root path to the bis system (root ip name on the dns server)
Const MCCISiteName = "http://bis/"
Const MCCIRootPath = "http://bis/"
Const MCCIWebRoot = "http://bis/"
Const RootPath = "http://bis/"
'Const ConnectionString = "Provider=sqloledb; server=tick-MPERRY-S; database=tick; uid=bisSA;pwd=cubuncle;"
'Const ClientData = "\\md-int-fp-01\BIS\ClientData"
Const TempCorrespondence = "\\mmd-int-fp-01\mccigeneral\Correspondence Upload\"
Const MemoPath = "\\mmd-int-fp-01\general\Legal Memo Upload\"
Const CareerPath = "\\mmd-int-fp-01\BIS\munibode.com\Applications\"
Const OrdPath = "\\mmd-int-fp-01\BIS\accounts\accts\"
'BIS Documents root path
Const DocumentPath = "\\mmd-int-fp-01\BIS\Accounts\Documents\"
Const VirtualPath = "\\mmd-int-fp-01\BIS\Accounts\"
Const ClientData = "\\mmd-int-fp-01\BIS\mcciclientdata\"
Marvin L. Perry Jr.