Avatar of LimonKavas
LimonKavas
Flag 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
ASPMySQL Server

Avatar of undefined
Last Comment
LimonKavas

8/22/2022 - Mon
Brad Howe

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
Brad Howe

ASKER CERTIFIED SOLUTION
B_Dorsey

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy