ASP Forum
Connection to a database
George11 | Posted 8:08pm 21. February 2008 Server Time |

My question is: do I have to write:

connPath = "DBQ=\\serverpath\database\mydatabse.mdb"  or do I have to write:

connPath = "DBQ=\\serverpath/database/mydatabase.mdb"  or something else.



I am not sure do I have to write DBQ=\\ or DBQ=\ or I have to write something else.



Many thanks for your input,

George11



DJGray | Posted 1:13pm 29. February 2008 Server Time |

George,

Create the folder you want your database to live in and set the permissions for that folder as you need them.  For example, I need the IUSER_MACHINENAME account to be able to write to that DB, so I grant that user write permissions for the specific folder.

So, let's say you create a folder in your wwwroot called access_db, and the only file that lives there is your DB.  As I understand it, that meets the requirements of your customer.  Then do something like this to connect to it.

' Open the database connection
set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=DSNtemp & "DBQ=" & server.mappath("/access_db/georgeaccessdatabase.mdb")
conn.Mode = 3
conn.Open DSNtemp

You now have an open connection to this DB and can make calls to it as you so desire.

When you're done, be sure to call

conn.Close
Set conn = nothing


Reply to Post Connection to a database



Back to Forum Page