Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: URGENT! Connection String


Message #1 by "anthony deeming" <anthony@a...> on Tue, 28 May 2002 21:16:21
Help

Please can someone tell me what I need to do to create a connection string 
to an Access database on IIS. I've tested the site on a local webserver 
running on my PC, which works fine, using the 'include' code from the ASP 
Beginners book:

<%
Dim strConn
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
Source=C:\Inetpub\wwwroot\name.mdb; Persist Security Info=False" 
%>

and then created the connection as follows: 

<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "Zones", strConn, adOpenStatic, adLockReadOnly, adCmdTable
.......
%>

Although I've amended the path to the db in the connection string, when 
uploading to the live server, only the flat HTML is rendered in the 
browser and I get a error '800a01a8' object error! So there's a problem 
with the db connection. 

I'm so annoyed that I can't get the connection to work no matter what I 
try and I know it's something simple. Please help!  
Message #2 by Karri Peterson <KPeterson@C...> on Tue, 28 May 2002 15:19:00 -0500
Anthony, is there a reason you are not just using a dsn and
doing like:

strConn = "DSNNAME"

I am probably going to be starting a conversation on how stupid this
suggestion is, because there's a bunch of default junk that happens when you
do it this way...

Karri

-----Original Message-----
From: anthony deeming [mailto:anthony@a...]
Sent: Tuesday, May 28, 2002 4:16 PM
To: Access ASP
Subject: [access_asp] URGENT! Connection String


Help

Please can someone tell me what I need to do to create a connection string 
to an Access database on IIS. I've tested the site on a local webserver 
running on my PC, which works fine, using the 'include' code from the ASP 
Beginners book:

<%
Dim strConn
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
Source=C:\Inetpub\wwwroot\name.mdb; Persist Security Info=False" 
%>

and then created the connection as follows: 

<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "Zones", strConn, adOpenStatic, adLockReadOnly, adCmdTable
.......
%>

Although I've amended the path to the db in the connection string, when 
uploading to the live server, only the flat HTML is rendered in the 
browser and I get a error '800a01a8' object error! So there's a problem 
with the db connection. 

I'm so annoyed that I can't get the connection to work no matter what I 
try and I know it's something simple. Please help!  
Message #3 by "eric mkuska" <risho@c...> on Tue, 28 May 2002 22:40:53
Try using
dbPath1 = Server.MapPath("../name.mdb")
MyDB1.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath1


also might want to use DSN-less connection

in addition, during the upload the IIS writes to a temp folder before it 
it copies the files in the wwwroot directory and if you don't have 
permission it will not work. If it is a remote server have the server 
admin check that for you.

Good luck

Eric


> Help

> Please can someone tell me what I need to do to create a connection 
string 
t> o an Access database on IIS. I've tested the site on a local webserver 
r> unning on my PC, which works fine, using the 'include' code from the 
ASP 
B> eginners book:

> <%
D> im strConn
s> trConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
S> ource=C:\Inetpub\wwwroot\name.mdb; Persist Security Info=False" 
%> >

> and then created the connection as follows: 

> <%
D> im objRS
S> et objRS = Server.CreateObject("ADODB.RecordSet")
o> bjRS.Open "Zones", strConn, adOpenStatic, adLockReadOnly, adCmdTable
.> ......
%> >

> Although I've amended the path to the db in the connection string, when 
u> ploading to the live server, only the flat HTML is rendered in the 
b> rowser and I get a error '800a01a8' object error! So there's a problem 
w> ith the db connection. 

> I'm so annoyed that I can't get the connection to work no matter what I 
t> ry and I know it's something simple. Please help!  
Message #4 by Karri Peterson <KPeterson@C...> on Tue, 28 May 2002 16:41:46 -0500
This is good.

Hey, Eric, I can see why you would want to use Server.MapPath over just a
path string, but
do you have an opinion/viewpoint of using DSN-less connections over DSN
connections?  

I wondered what you saw the difference as.

Karri

-----Original Message-----
From: eric mkuska [mailto:risho@c...]
Sent: Tuesday, May 28, 2002 5:41 PM
To: Access ASP
Subject: [access_asp] Re: URGENT! Connection String


Try using
dbPath1 = Server.MapPath("../name.mdb")
MyDB1.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & dbPath1


also might want to use DSN-less connection

in addition, during the upload the IIS writes to a temp folder before it 
it copies the files in the wwwroot directory and if you don't have 
permission it will not work. If it is a remote server have the server 
admin check that for you.

Good luck

Eric


> Help

> Please can someone tell me what I need to do to create a connection 
string 
t> o an Access database on IIS. I've tested the site on a local webserver 
r> unning on my PC, which works fine, using the 'include' code from the 
ASP 
B> eginners book:

> <%
D> im strConn
s> trConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
S> ource=C:\Inetpub\wwwroot\name.mdb; Persist Security Info=False" 
%> >

> and then created the connection as follows: 

> <%
D> im objRS
S> et objRS = Server.CreateObject("ADODB.RecordSet")
o> bjRS.Open "Zones", strConn, adOpenStatic, adLockReadOnly, adCmdTable
.> ......
%> >

> Although I've amended the path to the db in the connection string, when 
u> ploading to the live server, only the flat HTML is rendered in the 
b> rowser and I get a error '800a01a8' object error! So there's a problem 
w> ith the db connection. 

> I'm so annoyed that I can't get the connection to work no matter what I 
t> ry and I know it's something simple. Please help!  
Message #5 by "Ken Schaefer" <ken@a...> on Wed, 29 May 2002 12:46:32 +1000
Dim strConn
strConn = _
    "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.Mappath("/name.mdb") & ";" & _
    "Persist Security Info=False"

Replace the part in Server.Mappath() with the path to the database.

Also, why don't you store this in an application variable, and set it in
Application_OnStart(). That way, you only need to change it in one place:

Sub Application_OnStart

    Application("DBConnString") = _
        "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & Server.Mappath("/name.mdb") & ";" & _
        "Persist Security Info=False"

End Sub

and then in your pages

objConn.Open Application("DBConnString")

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "anthony deeming" <anthony@a...>
Subject: [access_asp] URGENT! Connection String


: Help
:
: Please can someone tell me what I need to do to create a connection string
: to an Access database on IIS. I've tested the site on a local webserver
: running on my PC, which works fine, using the 'include' code from the ASP
: Beginners book:
:
: <%
: Dim strConn
: strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data
: Source=C:\Inetpub\wwwroot\name.mdb; Persist Security Info=False"
: %>
:
: and then created the connection as follows:
:
: <%
: Dim objRS
: Set objRS = Server.CreateObject("ADODB.RecordSet")
: objRS.Open "Zones", strConn, adOpenStatic, adLockReadOnly, adCmdTable
: .......
: %>
:
: Although I've amended the path to the db in the connection string, when
: uploading to the live server, only the flat HTML is rendered in the
: browser and I get a error '800a01a8' object error! So there's a problem
: with the db connection.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Message #6 by "Ken Schaefer" <ken@a...> on Wed, 29 May 2002 12:52:47 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Karri Peterson" <KPeterson@C...>
Subject: [access_asp] RE: URGENT! Connection String


: Anthony, is there a reason you are not just using a dsn and
: doing like:
: 
: strConn = "DSNNAME"
: 
: I am probably going to be starting a conversation on how stupid this
: suggestion is, because there's a bunch of default junk that happens 
: when you do it this way...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

My $0.02

a) DSN needs to be set up on the server
b) The ODBC driver for Access sucks
www.adopenstatic.com/faq/whyOLEDB.asp

Cheers
Ken

Message #7 by "anthony deeming" <anthony@a...> on Wed, 29 May 2002 09:56:57
Karri

The book (because I don't know any better) suggests that using DSN and 
ODBC is the old and slow way of doing things. Although if I couldn't get 
the OLEDB connection working then I was going to go down the DSN route 
regardless.  

> Anthony, is there a reason you are not just using a dsn and
doing like:

strConn = "DSNNAME"

I am probably going to be starting a conversation on how stupid this
suggestion is, because there's a bunch of default junk that happens when 
you
do it this way...

Karri

-----Original Message-----
From: anthony deeming [mailto:anthony@a...]
Sent: Tuesday, May 28, 2002 4:16 PM
To: Access ASP
Subject: [access_asp] URGENT! Connection String


Help

Please can someone tell me what I need to do to create a connection string 
to an Access database on IIS. I've tested the site on a local webserver 
running on my PC, which works fine, using the 'include' code from the ASP 
Beginners book:

<%
Dim strConn
strConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data 
Source=C:\Inetpub\wwwroot\name.mdb; Persist Security Info=False" 
%>

and then created the connection as follows: 

<%
Dim objRS
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "Zones", strConn, adOpenStatic, adLockReadOnly, adCmdTable
.......
%>

Although I've amended the path to the db in the connection string, when 
uploading to the live server, only the flat HTML is rendered in the 
browser and I get a error '800a01a8' object error! So there's a problem 
with the db connection. 

I'm so annoyed that I can't get the connection to work no matter what I 
try and I know it's something simple. Please help!  

  Return to Index