Help with global.asa & sql database

Help with global.asa & sql database

am 28.06.2006 19:41:03 von Richard

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




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=20

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

/test.asp, line 43=20


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



charset=3Diso-8859-1">




Hi There

 

I'm attempting to clean up some code in =
our website=20
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=20
the database with multiple include files.

 

Here's a snip of my global.asa =
file

 

<script language=3Dvbscript=20
runat=3Dserver>
Sub=20
Application_OnStart() 
 
 conn_test1=
"PROVIDER=3DMSDASQL;DRIVER=3D{SQL Server};"
 conn_test1 =3D =
conn_test1 &=20
"SERVER=3Dtheservername;DATABASE=3Dthedbasename;"
 conn_test1 =
=3D conn_test1=20
&=20
"UID=3Dtheusername;PWD=3Dthepassword;"
 
 application("te=
st1_app") =
conn_test1 

 

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

 
END =
SUB

 

size=3D2></script>

 

 

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

 

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

 

I get this error

 

Microsoft OLE DB Provider =
for ODBC=20
Drivers error '80004005'

[Microsoft][ODBC Driver =
Manager] Data=20
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--

Re: Help with global.asa & sql database

am 28.06.2006 19:48:27 von Richard

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" wrote in message =
news:OAtJIotmGHA.3596@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




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=20

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

/test.asp, line 43=20


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



charset=3Diso-8859-1">




Update on the problem....

 

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

 

Thanks

 

-rich

style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Richard" < =
href=3D"mailto:rcowell%nospam%@gmail.com">rcowell%nospam%@gm ail.com&g=
t;=20
wrote in message =
href=3D"news:OAtJIotmGHA.3596@TK2MSFTNGP03.phx.gbl">news:OAt JIotmGHA.3596=
@TK2MSFTNGP03.phx.gbl...

Hi There

 

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

 

Here's a snip of my global.asa =
file

 

<script =
language=3Dvbscript=20
runat=3Dserver>
Sub=20
Application_OnStart() 
 
 conn_test1=
"PROVIDER=3DMSDASQL;DRIVER=3D{SQL Server};"
 conn_test1 =3D =
conn_test1 &=20
"SERVER=3Dtheservername;DATABASE=3Dthedbasename;"
 conn_test1 =
=3D conn_test1=20
&=20
=
"UID=3Dtheusername;PWD=3Dthepassword;"
 
 application("te=
st1_app")=20
=3D conn_test1 

 

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


END =
SUB

 

size=3D2></script>

 

 

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

 

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

 

I get this error

 

Microsoft OLE DB Provider =
for ODBC=20
Drivers error '80004005'

[Microsoft][ODBC Driver =
Manager] Data=20
source name not found and no default driver specified =

/test.asp, line 43=20


 

any ideas what's wrong?

 

Thanks

 

size=3D2>-Rich


------=_NextPart_000_0017_01C69AB9.89782EE0--

Re: Help with global.asa & sql database

am 28.06.2006 19:56:12 von reb01501

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.

Re: Help with global.asa & sql database

am 28.06.2006 20:37:30 von Richard

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]" wrote in message
news:uWvSmwtmGHA.4816@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.
>
>

Re: Help with global.asa & sql database

am 28.06.2006 20:47:41 von reb01501

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]" wrote in message
> news:uWvSmwtmGHA.4816@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.

Re: Help with global.asa & sql database

am 28.06.2006 20:52:20 von Richard

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


"Bob Barrows [MVP]" wrote in message
news:efw7WNumGHA.492@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]" wrote in message
>> news:uWvSmwtmGHA.4816@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.
>
>