This topic is locked

Mysql failover connection script

11/11/2006 5:41:35 PM
ASPRunnerPro General questions
D
dlangham author

I have 2 mysql databases which are mirrored for redundancy on seperate servers at different locations, is there a script for asprunner that will try to connect to the first database and if database is down then try the second connection script which would point to the other database?

I would appreciate any help at all on this one as I have tried google, but no luck.

Sergey Kornilov admin 11/14/2006

Dale,
you can try something like this:

On Error Resume Next

set dbConnection = server.CreateObject("ADODB.Connection")

dbConnection.ConnectionString = strConnection

dbConnection.Open

if Err.Number<>0 then

Err.Clear

dbConnection.ConnectionString = strConnection2

dbConnection.Open

end if

On Error Goto 0


This is just a basci idea. You can add more error checking etc.

D
dlangham author 11/21/2006

Dale,

you can try something like this:

On Error Resume Next

set dbConnection = server.CreateObject("ADODB.Connection")

dbConnection.ConnectionString = strConnection

dbConnection.Open

if Err.Number<>0 then

Err.Clear

dbConnection.ConnectionString = strConnection2

dbConnection.Open

end if

On Error Goto 0


This is just a basci idea. You can add more error checking etc.


Thanks,
Thats great.