Do you really need a server?

They have: 15 posts

Joined: Jun 2001

I am trying to connect to my database without the use of a server (having my computer act as a local server instead of using the one at work). I have the following code:

<?php
Set Cnn
= Server.CreateObject("ADODB.Connection")
Set RS=Server.CreateObject("ADODB.Recordset")
Cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\ShiftNotesDatabase.mdb;"
dbUserName = "Select * From tblUserLogin"
RS.Open dbUserName,Cnn,adOpenStatic
?>

<?php
While Not RS.EOF
?>

<?php
Response
.Write(RS.Fields("UserID"))
?>

<?php
RS
.MoveNext
WEND
?>

I noticed though that the connection doesn't work. I know the path name is right, and I'm pretty sure that everything is set right, but correct me if I'm wrong. When i say local server, I thought you could put the path name of the database (I'm working with Access) and things should click from there. Help me out. I'll be appreciated. Thanks.

Roll eyes DizzE

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

You're correct, that should work. A couple things to check:

1) Are permissions set correctly? Since the database is located on the root of the machine you must give the IUSR_machinename account access to that directory/file.

2) Do you have the Jet 4.0 driver installed?

Try moving the database into your web folder and try the following connection code:

ConnStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ="
ConnStr = ConnStr & server.mappath("/ShiftNotesDatabase.mdb")

Set DBConn = server.createobject("adodb.connection")
DBConn.Open ConnStr

Let me know if that works!

PJ | Are we there yet?
pjboettcher.com

They have: 15 posts

Joined: Jun 2001

I wouldn't even know how to check to see if my permissions are set correctly. How do you do that?

I haven't checked to see if I have a Jet 4.0 installed. However, I do have MS Access, so wouldn't that be included when downloaded?

Another problem arises. I don't think it's a problem with the connection code per se. I think my machine is just not regonizing ASP. Since ASP is a server side type of language, do I need to be on an actual server in order for the code to be understood?

I'm off to try the last suggestion in a few minutes. Wish me luck.

DizzE

They have: 15 posts

Joined: Jun 2001

I ment to add that the reason why i think the machine is just not recognizing ASP is because I tried to display a simple message using asp:

<?php
Response
.Write("Hello World")
?>

and also
<?php
=Response.Write("Hello World")
?>

and nothing even came up in my browser.

DizzE

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

Yes, you have to be running some type of web server software for ASP to function. If you're on Windows 2000 Professional then install the IIS files (go to add/remove programs in the control panel, select add/remove windows components, then select IIS. If you're on Windows 95/98/ME you'll have to install Personal Web Server (I can't remember exactly how to do this, maybe the same way as IIS?).

Once you've done this then try the following code:

<?php
strTest
= "It's Working!"
?>

<?php
=strTest
?>

You should get a page that says "It's Working". If that works, then we can tackle your first problem Wink

PJ | Are we there yet?
pjboettcher.com

They have: 15 posts

Joined: Jun 2001

I do have a personal web server, but I have to have a connection in order to tweak it. Unfortunately, at work, they won't allow most people to be on the ineternet, so there's no way i can do that.

What about if i'm using Windows NT, and have a local intranet. What do I do then? This is sooo crazy.

~DizzE

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

If you're on Windows NT you can install IIS 4, just make sure you have at least:

Service Pack 3 or higher installed
Internet Explorer 4.0 or higher installed

Then you can install the Windows NT Option pack which installs all the necessary files. Just go to this link http://www.microsoft.com/ntserver/techresources/webserv/option_pack4.asp , the link to download the option pack is at the bottom of the page.

PJ | Are we there yet?
pjboettcher.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.