Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database connection Scripting

Status
Not open for further replies.

jedel

Programmer
Joined
Jan 11, 2003
Messages
430
Location
AU
Hello all,
I have been playing with different types of database connections using dreamweaver MX and MS Access 2000. One particular connection that I am interested in is the custome made connection to databases where you write a script on the page to connect to you database. The Dreamweaver tutorial shows this as the Script:

Driver = {Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("/jedel/guestbook.mdb")

This hasn't worked for me and I suspect that there may be some code missing?

I amd using PWS as the testing server. Any help would be great

Thanks in advance

Jedel
 
Hi...
when the connection string did not work, what wat the error ?
and by the way, try changing then Slash with BackSlash in the mappath like this :
Driver = {Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("\jedel\guestbook.mdb")

----
TNX.
E.T.
 
Ehsant,
Thanks for your prompt reply. I will try the backslash when I get home. The database icon appears in Dreamweaver fine, but when I expand it to look for the tables that are supposed to be there, they aren't. I tested the connection and it stated something like 'the connection was not a correct OLE DB format' I would have to go home and reproduce the error message to get the exact words.

At the end of the day, I want to create some simple ASP pages that will connect to an uploaded database on my ISP without having to have my ISP create an OBDC connection.

Cheers

Jedel
 
alrighty, the backlash thing?!? after a few test runs awhile ago when this was a concern the Server.mapPath seemed to have changed the direction accordingly for most instances when I. BUT, the big error I see here is the fact you have that first / in front of the directory listing.

That in fact will tell it to come out as
jedel/jedel/guestbook.mdb

The solution to the problem. never add a backlash to the start of the string in the mapPath parameter.
as:
Server.MapPath("jedel/guestbook.mdb")



_________________________________________________________
$str = "sleep is good for you. sleep gives you the energy you need to function";
$Nstr = ereg_replace("sleep","coffee",$str); echo $Nstr;

onpnt2.gif
[/sub]
 
Hi All,
I'm Sorry to tell you that none of the above worked. I still have the same problem. The exact error message is:

"Format of the initializing string does not conform to the OLE DB Specification"

This is painful as I do not want an OLE DB connection, I was hoping for an OBDC connection as I am using Windows 98. OLE DB is only available on NT, 2000 & XP

Here is the String to date:

Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("jedel_site\guestbook.mdb")

I have tried Forward slash, backslash, slashes before and not before the virtual path, I get the same error message.

Whats Next??

Cheers,

Jedel

 
er, how about a quotes around the originakl, or a beginning quote on the latest version?
Code:
Driver="{Microsoft Access Driver (*.mdb)}; DBQ="  &  Server.MapPath("jedel_site\guestbook.mdb")

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Tarwn,
I think we made some progress...to anthor error message. Thanks for your suggestion (I shouild have been obvious and I'll slap myself over the back of the head later).
Ok. the script so far:
"Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("jedel/guestbook.mdb")

the error message now says
"[Microsoft][OBDC Microsoft Access Driver]'(unknown)' is not a valid path make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
[Microsoft][OBDC Driver Manager] Driver's SQL SetConnectAttr failed"


My testing server path is and my physical directory is D:\jedel_site

Any more ideas?

Thanks in advance

Jedel
 
EUREKA!!!!!!!!!
I found the solution. It's amazing after you actually write something down(like the error message), the solution presents itself.

The problem was that I was putting too many names in the file path. becasue my http:// server address is jedel, I didn't need to add it. Just the forward slash before the database filename. So the Final Script is:

"Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/guestbook.mdb")

Thanks for all of your help gents

If I knew who and where you were, I'd buy you a beer!

Cheers for now

Jedel
[2thumbsup]
 
Ok, i'm just glad you didn't mention that I put that quote in the wrong place :P

Glad you found the solution :)

-Tarwn

01010100 01101001 01100101 01110010 01101110 01101111 01101011 00101110 01100011 01101111 01101101
29 3K 10 3D 3L 3J 3K 10 32 35 10 3E 39 33 35 10 3K 3F 10 38 31 3M 35 10 36 3I 35 35 10 3K 39 3D 35 10 1Q 19
Get better results for your questions: faq333-2924
Frequently Asked ASP Questions: faq333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top