HELP: Problem connecting ASP & Access DB using FP2003

J

John

Hi all,
I hope someone can help...I'm climbing the walls!!

I have a problem connecting an Access database within ASP code.
Here is my connection string which is inside an include
file...."connectstring.asp"

strconnect="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data
Source=Security.mdb" & "Persist Security Info=False"

Here is the code within a main ASP page called "maintain.asp"

Set objConn = Server.CreateObject ("ADODB.Connection")
Set objRS = Server.CreateObject ("ADODB.Recordset")
objConn.Open strconnect
objRS.Open "News", objConn, adOpenStatic,
adLockOptimistic, adCmdTable

The database is within the same folder as the rest of the ASP pages

After uploading, I run through the various pages.
Internet Explorer won't display "maintain.asp"
Netscape 7.2 displays the following error.....

Microsoft JET Database Engine error '80004005'

Could not find file 'c:\windows\system32\inetsrv\Security.mdbPersist
Security Info=False'.

/dbase/maintain.asp, line 25

I've no idea how the above directory tree came about?

Any help would be appreciated.

TIA.
 
M

Mark Fitzpatrick

First, check the connection string itself. You don't have a semicolon after
the Security.mdb; to seperate the data source attribute from the persist
security attribute

You may also have to alter the connection string information as it's
probably just trying to find it within the IIS source location itself. Try
mapping it to the current path like so:

strconnect="Provider=Microsoft.Jet.OLEDB.4.0; DataSource=" &
Server.MapPath("Security.mdb") & "Persist Security Info=False"

You also don't need to be concatenating the different parts together with
the & unless you're handling variables or injecting the results of a
function. String concatenation is a very expensive operation processing-wise
and using them only as needed may give a slight performance boost ona busy
site.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
T

Thomas A. Rowe

The database needs to be in the fpdb folder so that FP can set the correct permission on the folder
and the database.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
J

Jon Spivey

Hi John,

You need to specify a full path to the database (if you leave off the path
ASP will look for the DB in your system directory) there's no need for the
persist security info attribute so you'd have
strconnect="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &
server.mappath("/DbFolder/" & "Security.mdb")
or you can use a physical path
strconnect="Provider=Microsoft.Jet.OLEDB.4.0; Data
Source="c:\dbfolder\DbFolder\Security.mdb"

If you use the second method you'll probably need to modify the DB path
before you upload to your host
 
J

John

Thanks Jon,
That seems to have solved the connection problem.
However, I now appear to have what looks like a permissions problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top