Discussion Locked

set odbc conn/dsn on a remote server?

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi Everyone,

I've created my .asp pages and .mdb and I uploaded them to my web hosts web server. Do I need to create an odbc conn server side to get my .asp pages to work. Can I do it remotely or do I have to have an admin at my web host set itup. Thanks for your assistance.

7 replies

by michealirwin

weeeell... ! The program on your machine that's interpreting the ASP (which will be part of the Web Server, most likely) is the one that nneeds a connection to the data, so that's where the connection should go. Remember too that the Web Server runsindependently of user logins on the server, so make it a System ODBC DSN and avoid any user-specific items like mapped drive letters (Win NT renews UNC very frequently, so you may also have slow-downs there ...).

You don't say what sort of database you're using, so I'll assume that it's something that comes with a database install and also a client installation. Your ODBC instance links to the local instance of the Client software, so install that first and make sure it works before adding the ODBC part.

As for who can do it, that person will need admin rank, no matter what OS you're using.

Good luck !

by chrandrob

You have two options. You can create a connection to it by using a connection string. For an Access database (mdb), it would look like this:

Dim objCon

Set objCon = Server.CreateObject ("ADODB.Connection")
MdbFilePath = Server.MapPath("/cgi-bin/members.mdb")
objCon.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"

You would do this in your code on the page.

The second option is to set up a DSN which can only be done locally. Admin rights are not neccessary,but local access is. Your host may not allow DSN's or they may charge extra for them.

Even if you use a DSN, you will still have to create the connection in your code. Like this:

Dim objCon

Set objCon = Server.CreateObject ("ADODB.Connection")
objCon.Open "DSN=dsnName;UID=Username;PSWD=password;"

Good luck.

by rsv

HI,
There are two options for establishing a Database Connection, one is DSNless connection and other one is DSN connection.

1.DSNless Connection:

Dim MyCon
Dim mdbFile
Dim strConString

mdbFile=Server.Mappath("mdbfilename.mdb")
strConString="Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & mdbFile & ";"

Set MyCon = Server.CreateObject ("ADODB.Connection")

MyCon.Open strConString

2.DSN Connection:
For establishing a DSN connection you require a DSN on your hosting server (it may be charged, may not be charged based on your hosting server features) which will be mapped to your Access Database, for this connection code is....

Dim MyCon
Dim strConString

strConString="DSN=DSName;UID=username;PWD=password"
Set MyCon = Server.CreateObject ("ADODB.Connection")
MyCon.Open strConString

Hope this is helpful to you. Have great time.

This discussion is closed to new replies.