This topic is locked

Dynamic connection string

2/16/2008 3:25:45 PM
ASPRunnerPro General questions
N
nitzan author

I need to have a dynamic connection string:

One is for my local machine, on which I do the coding and testing

and second is for the web server on which I deploy the code.

Since I'm using MySQL, the string is different - for example the server.
I thought on using something like:
sqlDriver="DRIVER={MySQL ODBC 3.51 Driver};"

hostID=request.ServerVariables("LOCAL_ADDR")

if (hostID="127.0.0.1") then

sqlSERVER="SERVER=myServer;"

sqlDB="DATABASE=myDB;"

UID="USER=myUser;"

PWD="PASSWORD=myPass;"

else

sqlSERVER="SERVER=my2Server;Port=serverPort;"

sqlDB="DATABASE=serverDB;"

UID="USER=serverUser;"

PWD="PASSWORD=serverPass;"

end if
Any idea on how to implement something similar?

Sergey Kornilov admin 2/18/2008

You can place this code to include\dbconnection.asp file.
Just make sure you generated connection string in the same format that ASPRunnerPro uses.

A
ashumak 5/18/2008

The information on both my machine and the remote server are exactly the same except for the password. Can I do something the same? I don't want to have to edit the online dbconnection file everytime I change something in ASPRunner..
Thanks,
Alan