Link to home
Create AccountLog in
Avatar of LimonKavas
LimonKavasFlag for Chile

asked on

Create Global.asa for MySql

Hi :

I am creating the global.asa file to mysql as follows:

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
      Sub Session_OnStart()
            Session("ConnectionString") = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=lw_holding;Uid=lwconsulting;Pwd=lw_consul"
      End Sub
      Sub Session_OnEnd()
      End Sub
</SCRIPT>


but the time to prove it in asp:

<%
dim conn
conn = Session("ConnectionString")
Response.Write(conn)
Response.End
%>

seems that the global.asa file did not run because I fail to get the connection string ..

as I create? and check it out?


thanks
Avatar of Brad Howe
Brad Howe
Flag of Canada image

Hi there,

global.asa in root directory.
<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Session_OnStart
  Session("ConnectionString")= "Driver={MySQL ODBC 3.51 Driver};server=<SERVER>;data source=<ODBC CONNECTION>;uid=<UID>;pwd=<PASSWORD>"
End Sub
</SCRIPT>


For MY SQL you need to have an ODBC System DSN configured.
driver={MySQL ODBC 3.51 Driver};server=<SERVER>;data source=<ODBC CONNECTION>;uid=<UID>;pwd=<PASSWORD>"

Let us know,
Cheers,
Hades666
ASKER CERTIFIED SOLUTION
Avatar of B_Dorsey
B_Dorsey

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of LimonKavas

ASKER

thanks for the answer ...

I needed to leave the global.asa in the root directory, it had within the home directory of my future application.

I finally did so:


sub Application_OnStart
 Application("ConnectionString") = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=1111;Uid=222222;Pwd=33333"
end sub

------------------ 00000 -----------

set ConexionLW = Server.CreateObject("ADODB.Connection")
	ConexionLW.Open Application("ConnectionString")
	SQL = "Select * From usuario"
Set RS = ConexionLW.Execute(SQL)

Open in new window