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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC question

Status
Not open for further replies.

bvahan5

Programmer
Jun 11, 2005
63
RU
I understand and do use simple ODBC connection (thru Control Panel ODBC) to Access DB on the server in my office.

There are some web sites which I run on Godaddy. Godaddy reqires the following connection way to DB:

dsn_name = "access_tetra1"
sDSNDir = Server.MapPath("/_dsn")
connectstr = "filedsn=" & sDSNDir & "\" & dsn_name
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

I need to configure similar connection on my "local" web server. What I have to do for it?
where "_dsn" folder should be?
Do I need to place my mdb there?
What about folder properties?
I ask for detailed step by step points to do to be able to use godaddy style of connetion on my local web server.

Thanks in advance.
 
Avoid ODBC, it's useless and mostly pointless.

You will have a more reliable, functional and portable solution by using a DSN-less OLEDB connection string:

Access 2007:
earlier versions:

you don't need to create an entry in ODBC, just use the connection string from above and use the correct path to the data file.



=======================================
LessThanDot - The IT Community of the 21st Century

A smile is worth a thousand kind words. So smile, it's easy! :)
 
thanks
however I do need a connection to .mdb same way as written in the initial post

I don't understand what I have to do to make it work

repeating once more, this type of connection uses Godaddy.com, a hosting provider of some of my web sites

I need to make such type of connection work on my local web server and I don't understand the use of "_dsn" folder (see a script above)
 

Have you tried what I've suggested, or just assumed you know better ?

It is very unlikely that you need a dsn with godaddy web hosting - you can just put you mdb file in a secure directory and then use the OLEDB connection string I posted multiple examples of above to connect to it.

Just post your mdb file to that _dsn directory, create the same on your local webserver and store the mdb there. then change this line:

connectstr = "filedsn=" & sDSNDir & "\" & dsn_name

To the connection string I pointed out in the above posts, replacing the database path *and* filename with the name of your database.



=======================================
LessThanDot - The IT Community of the 21st Century

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top