I have two databases running off of the same site, and i need to use two global.asa's. since this is not possible, can I put both connections in one file? I did try just merging the two and that did not work, is there another way to do this? bb
Usually you would set the application variable for your connection in the global.asa - you can set as many variables as you would like. I don't believe that you are actually making the connection in the global file.
yourPages.asp
set objConn1 = server.createobject("adodb.connection"
objConn1.open application("connStr1"
set objConn2 = server.createobject("adodb.connection"
objConn1.open application("connStr2" -- Just trying to help...
<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
You mean that you set a variable in the global.asa file and cannot access it from the pages? This is very strange. Can you post the global.asa and a page where you are accessing the application variable? -- Just trying to help...
<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
Sub Application_OnStart()
'Application("DB_CONNECTION_STRING" = "DSN=HIPPA"
'Application("DB_CONNECTION_LOGIN" = "hippa"
'Application("DB_CONNECTION_PASSWORD" = "hippa"
End Sub
Sub Application_OnEnd()
End Sub
Sub Session_onStart()
'Set Session("DB_CONNECTION" = Server.CreateObject("ADODB.Connection"
'Session("DB_CONNECTION".Open Application("DB_CONNECTION_STRING",Application("DB_CONNECTION_LOGIN",Application("DB_CONNECTION_PASSWORD"
You need to change you variable names for the second connection....
Sub Application_OnStart()
Application("DB_CONNECTION_STRING" = "DSN=HIPPA"
Application("DB_CONNECTION_LOGIN" = "hippa"
Application("DB_CONNECTION_PASSWORD" = "hippa"
Application("DB_CONNECTION_STRING_2" = "DSN=newDSN"
Application("DB_CONNECTION_LOGIN_2" = "newUser"
Application("DB_CONNECTION_PASSWORD_2" = "newPassword"
End Sub
It would be even easier if you wrote the complete connection string in one vairable per connection
Sub Application_OnStart()
Application("DB_CONNECTION_STRING" = "DSN=HIPPA;User Id=hippa;Password=hippa"
Application("DB_CONNECTION_STRING_2" = "DSN=newDSN;User Id=newUser;Password=newPassword"
End Sub
You may also want to use more descriptive names than ("DB_CONNECTION_STRING" & ("DB_CONNECTION_STRING2" -- Just trying to help...
<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
ok, it's the string2 i didn't didn't rename...i left it as string, because the rest i had changed...thanks..i will try it and let you know how it works... bb
He is just storing the string used to create the connection in application variables. He only uses them to create and open connections when they are necessary. That shouldn't cause any problems, should it? -- Just trying to help...
<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
Oops, I was just looking at the application variables - you guys are right about that! No session connections bberios, create, open, use and close them on the page that is called... -- Just trying to help...
<--- This is a wolf? We need a new icon.......
mikewolf@tst-us.com
Yes, they are commented out. They are just making sure you know not to uncomment them..... ---------------------------------------
HAPPY THANKSGIVING!!!!
mikewolf@tst-us.com
You need to change you variable names for the second connection....
Sub Application_OnStart()
Application("DB_CONNECTION_STRING" = "DSN=HIPPA"
Application("DB_CONNECTION_LOGIN" = "hippa"
Application("DB_CONNECTION_PASSWORD" = "hippa"
Application("DB_CONNECTION_STRING_2" = "DSN=newDSN"
Application("DB_CONNECTION_LOGIN_2" = "newUser"
Application("DB_CONNECTION_PASSWORD_2" = "newPassword"
End Sub
This still only allowed for one connection. I also uncommented the:
'Set Session("DB_CONNECTION" = Server.CreateObject("ADODB.Connection"
and it made no difference...any other suggestions...thanks so much!
You have defined two connections there. In order to use them all you need to do is choose which connection settings to use when you open your recordset or connection object. Since you won't be opening the connection in your global.asa file you will need to handle this in your web page.
As long as your doing that I can't see any reason that this would fail. Perhaps you should post the portion of the code where you are actually using the two differant connections.
-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
This space has nothing in it, it's all ni your imagination
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.