Help with global.asa & sql database

This is a multi-part message in MIME format.

------=_NextPart_000_0006_01C69AB8.7FDEB6C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi There

I'm attempting to clean up some code in our website so all the database =
connections are held in application variables in the global.asa file. =
This is to hopefully replace multiple forms of connecting to the =
database with multiple include files.

Here's a snip of my global.asa file

<script language=3Dvbscript runat=3Dserver>
Sub Application_OnStart()

conn_test1=3D "PROVIDER=3DMSDASQL;DRIVER=3D{SQL Server};"
conn_test1 =3D conn_test1 & =
"SERVER=3Dtheservername;DATABASE=3Dthedbasename;"
conn_test1 =3D conn_test1 & "UID=3Dtheusername;PWD=3Dthepassword;"

application("test1_app") =3D conn_test1

application("test2_app") =3D "Driver=3D{SQL =
Server};Server=3Dtheservername;UID=3Dtheusername;PWD=3Dthepa ssword;Databa=
se=3Dthepassword;"

END SUB

</script>


The code i'm using in my page to open test2_app is

dim oConn
Set oConn =3D Server.CreateObject("ADODB.Connection")
oconn.open application("test2_app")

I get this error

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no =
default driver specified

/test.asp, line 43


any ideas what's wrong?

Thanks

-Rich
------=_NextPart_000_0006_01C69AB8.7FDEB6C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.5335.5" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi There</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm attempting to clean up some code in =
our website
so all the database connections are held in application variables in the =

global.asa file. This is to hopefully replace multiple forms of =
connecting to
the database with multiple include files.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Here's a snip of my global.asa =
file</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><script language=3Dvbscript
runat=3Dserver><BR>Sub
Application_OnStart() <BR> <BR> conn_test1=3D
"PROVIDER=3DMSDASQL;DRIVER=3D{SQL Server};"<BR> conn_test1 =3D =
conn_test1 &
"SERVER=3Dtheservername;DATABASE=3Dthedbasename;"<BR> conn_test1 =
=3D conn_test1
&
"UID=3Dtheusername;PWD=3Dthepassword;"<BR> <BR> application("te=
st1_app") =3D
conn_test1 </STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG> application("test2_app") =
=3D
"Driver=3D{SQL
Server};Server=3Dtheservername;UID=3Dtheusername;PWD=3Dthepa ssword;Databa=
se=3Dthepassword;"</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG> <BR>END =
SUB</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2><STRONG></script></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The code i'm using in my page to open =
test2_app
is</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>   dim =
oConn<BR>   Set
oConn =3D Server.CreateObject("ADODB.Connection")<BR>   =
oconn.open
application("test2_app")</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I get this error </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><EM>Microsoft OLE DB Provider =
for ODBC
Drivers error '80004005' </EM></STRONG></FONT>
<P><FONT face=3DArial size=3D2><STRONG><EM>[Microsoft][ODBC Driver =
Manager] Data
source name not found and no default driver specified =
</EM></STRONG></FONT>
<P><FONT face=3DArial size=3D2><STRONG>/test.asp, line 43</STRONG> =
</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>any ideas what's wrong?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-Rich</FONT></DIV></BODY></HTML>

------=_NextPart_000_0006_01C69AB8.7FDEB6C0--
Richard [ Mi, 28 Juni 2006 19:41 ] [ ID #1373877 ]

Re: Help with global.asa & sql database

This is a multi-part message in MIME format.

------=_NextPart_000_0017_01C69AB9.89782EE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Update on the problem....

If I move the test.asp file to the ROOT directory, the problem is =
resolved. But if it's within a subdirectory, there's a problem...

Thanks

-rich
"Richard" <rcowell%nospam% [at] gmail.com> wrote in message =
news:OAtJIotmGHA.3596 [at] TK2MSFTNGP03.phx.gbl...
Hi There

I'm attempting to clean up some code in our website so all the =
database connections are held in application variables in the global.asa =
file. This is to hopefully replace multiple forms of connecting to the =
database with multiple include files.

Here's a snip of my global.asa file

<script language=3Dvbscript runat=3Dserver>
Sub Application_OnStart()

conn_test1=3D "PROVIDER=3DMSDASQL;DRIVER=3D{SQL Server};"
conn_test1 =3D conn_test1 & =
"SERVER=3Dtheservername;DATABASE=3Dthedbasename;"
conn_test1 =3D conn_test1 & "UID=3Dtheusername;PWD=3Dthepassword;"

application("test1_app") =3D conn_test1

application("test2_app") =3D "Driver=3D{SQL =
Server};Server=3Dtheservername;UID=3Dtheusername;PWD=3Dthepa ssword;Databa=
se=3Dthepassword;"

END SUB

</script>


The code i'm using in my page to open test2_app is

dim oConn
Set oConn =3D Server.CreateObject("ADODB.Connection")
oconn.open application("test2_app")

I get this error

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no =
default driver specified

/test.asp, line 43


any ideas what's wrong?

Thanks

-Rich
------=_NextPart_000_0017_01C69AB9.89782EE0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.5335.5" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Update on the problem....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>If I move the test.asp file to the ROOT =
directory,
the problem is resolved. But if it's within a subdirectory, there's a
problem...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-rich</FONT></DIV>
<BLOCKQUOTE dir=3Dltr
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Richard" <<A
=
href=3D"mailto:rcowell%nospam% [at] gmail.com">rcowell%nospam% [at] gm ail.com</A>&g=
t;
wrote in message <A
=
href=3D"news:OAtJIotmGHA.3596 [at] TK2MSFTNGP03.phx.gbl">news:OAt JIotmGHA.3596=
[at] TK2MSFTNGP03.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Hi There</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm attempting to clean up some code =
in our
website so all the database connections are held in application =
variables in
the global.asa file. This is to hopefully replace multiple forms of =
connecting
to the database with multiple include files.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Here's a snip of my global.asa =
file</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><script =
language=3Dvbscript
runat=3Dserver><BR>Sub
Application_OnStart() <BR> <BR> conn_test1=3D
"PROVIDER=3DMSDASQL;DRIVER=3D{SQL Server};"<BR> conn_test1 =3D =
conn_test1 &
"SERVER=3Dtheservername;DATABASE=3Dthedbasename;"<BR> conn_test1 =
=3D conn_test1
&
=
"UID=3Dtheusername;PWD=3Dthepassword;"<BR> <BR> application("te=
st1_app")
=3D conn_test1 </STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2><STRONG> application("test2_app") =3D
"Driver=3D{SQL
=
Server};Server=3Dtheservername;UID=3Dtheusername;PWD=3Dthepa ssword;Databa=
se=3Dthepassword;"</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><BR>END =
SUB</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><STRONG></STRONG></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2><STRONG></script></STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The code i'm using in my page to open =
test2_app
is</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>   dim =
oConn<BR>  
Set oConn =3D Server.CreateObject("ADODB.Connection")<BR>   =
oconn.open
application("test2_app")</STRONG></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I get this error </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG><EM>Microsoft OLE DB Provider =
for ODBC
Drivers error '80004005' </EM></STRONG></FONT>
<P><FONT face=3DArial size=3D2><STRONG><EM>[Microsoft][ODBC Driver =
Manager] Data
source name not found and no default driver specified =
</EM></STRONG></FONT>
<P><FONT face=3DArial size=3D2><STRONG>/test.asp, line 43</STRONG>
</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>any ideas what's wrong?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial =
size=3D2>-Rich</FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_0017_01C69AB9.89782EE0--
Richard [ Mi, 28 Juni 2006 19:48 ] [ ID #1373878 ]

Re: Help with global.asa & sql database

You really should get away from using ODBC connection strings:
http://www.aspfaq.com/show.asp?id=2126

Richard wrote:
> Update on the problem....
>
> If I move the test.asp file to the ROOT directory, the problem is
> resolved. But if it's within a subdirectory, there's a problem...
>

Is the subdirectory part of the application to which the global.asa file
applies?

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
reb01501 [ Mi, 28 Juni 2006 19:56 ] [ ID #1373879 ]

Re: Help with global.asa & sql database

It was an application problem - there was an application defined on the
subdirectory that wasn't needed.

Read the article about changing the connection strings, I wanted to avoid
having multiple includes for different databases, therefore the reason i was
going to use the global.asa applications.

Is there any other better way around the problem? It's quite a large site
and i'm just tasked to move the databases to a new sql server and i'm trying
to make sure that everything is in one place so i can move them as easily as
possible

-Rich

"Bob Barrows [MVP]" <reb01501 [at] NOyahoo.SPAMcom> wrote in message
news:uWvSmwtmGHA.4816 [at] TK2MSFTNGP03.phx.gbl...
> You really should get away from using ODBC connection strings:
> http://www.aspfaq.com/show.asp?id=2126
>
> Richard wrote:
>> Update on the problem....
>>
>> If I move the test.asp file to the ROOT directory, the problem is
>> resolved. But if it's within a subdirectory, there's a problem...
>>
>
> Is the subdirectory part of the application to which the global.asa file
> applies?
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Richard [ Mi, 28 Juni 2006 20:37 ] [ ID #1373880 ]

Re: Help with global.asa & sql database

I use include files myself ...

Richard wrote:
> It was an application problem - there was an application defined on
> the subdirectory that wasn't needed.
>
> Read the article about changing the connection strings, I wanted to
> avoid having multiple includes for different databases, therefore the
> reason i was going to use the global.asa applications.
>
> Is there any other better way around the problem? It's quite a large
> site and i'm just tasked to move the databases to a new sql server
> and i'm trying to make sure that everything is in one place so i can
> move them as easily as possible
>
> -Rich
>
> "Bob Barrows [MVP]" <reb01501 [at] NOyahoo.SPAMcom> wrote in message
> news:uWvSmwtmGHA.4816 [at] TK2MSFTNGP03.phx.gbl...
>> You really should get away from using ODBC connection strings:
>> http://www.aspfaq.com/show.asp?id=2126
>>
>> Richard wrote:
>>> Update on the problem....
>>>
>>> If I move the test.asp file to the ROOT directory, the problem is
>>> resolved. But if it's within a subdirectory, there's a problem...
>>>
>>
>> Is the subdirectory part of the application to which the global.asa
>> file applies?
>>
>> --
>> Microsoft MVP -- ASP/ASP.NET
>> Please reply to the newsgroup. The email account listed in my From
>> header is my spam trap, so I don't check it very often. You will get
>> a quicker response by posting to the newsgroup.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
reb01501 [ Mi, 28 Juni 2006 20:47 ] [ ID #1373881 ]

Re: Help with global.asa & sql database

ok thanks a lot for the advice - i'll try to implement then :)


"Bob Barrows [MVP]" <reb01501 [at] NOyahoo.SPAMcom> wrote in message
news:efw7WNumGHA.492 [at] TK2MSFTNGP05.phx.gbl...
>I use include files myself ...
>
> Richard wrote:
>> It was an application problem - there was an application defined on
>> the subdirectory that wasn't needed.
>>
>> Read the article about changing the connection strings, I wanted to
>> avoid having multiple includes for different databases, therefore the
>> reason i was going to use the global.asa applications.
>>
>> Is there any other better way around the problem? It's quite a large
>> site and i'm just tasked to move the databases to a new sql server
>> and i'm trying to make sure that everything is in one place so i can
>> move them as easily as possible
>>
>> -Rich
>>
>> "Bob Barrows [MVP]" <reb01501 [at] NOyahoo.SPAMcom> wrote in message
>> news:uWvSmwtmGHA.4816 [at] TK2MSFTNGP03.phx.gbl...
>>> You really should get away from using ODBC connection strings:
>>> http://www.aspfaq.com/show.asp?id=2126
>>>
>>> Richard wrote:
>>>> Update on the problem....
>>>>
>>>> If I move the test.asp file to the ROOT directory, the problem is
>>>> resolved. But if it's within a subdirectory, there's a problem...
>>>>
>>>
>>> Is the subdirectory part of the application to which the global.asa
>>> file applies?
>>>
>>> --
>>> Microsoft MVP -- ASP/ASP.NET
>>> Please reply to the newsgroup. The email account listed in my From
>>> header is my spam trap, so I don't check it very often. You will get
>>> a quicker response by posting to the newsgroup.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
Richard [ Mi, 28 Juni 2006 20:52 ] [ ID #1373882 ]
Webserver » microsoft.public.inetserver.asp.db » Help with global.asa & sql database

Vorheriges Thema: Query Problem..
Nächstes Thema: MySql UTF-8