Link to home
Start Free TrialLog in
Avatar of eugene007
eugene007

asked on

DSN

<%
Dim strConnect
strConnect = "DSN=mydsn"
'if you are using a username and password for it
'strConnect="DSN=mydsn;UID=username;PWD=password
'and place your username and password in their places
%>


Can anyone explain to me how to use the DSN in a
webserver?.


Regards

Eugene


Avatar of eugene007
eugene007

ASKER

Reminder:
I am using an MS Access database in my webserver.
ASKER CERTIFIED SOLUTION
Avatar of Paul Maker
Paul Maker
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I am using a commercial webserver over the Internet.
So, can I set up my DSN the same way as I set up
in my desktop PC?.

Regards

Eugene
If you are using a commercial offsite webserver that you do not have control over, use the DSNLess connection like makerp suggested
So if I intend to create a DSN on my Commercial webserver
over the Internet which I do not have control, I will have to ask the admin guys to set it up.

Regards

Eugene
Intresting..:)

Regards
Eugene
If they set up a DSN for you, they'll prolly charge you a one time set-up fee. I'd recommend either DSNless or a file DSN for remote servers.
Ask the admin guy to create a system DSN on the server machine if you really wish to use a DSN. If they do charge you, then you might wish to use a DSNless connection. Or maybe you would like to read the following links and change it into a OLEDB connection. I would also like to suggest using the Server.MapPath method to indicate your Access location.

http://www.adopenstatic.com/faq/whyOLEDB.asp
http://www.adopenstatic.com/faq/OLEDBConnection.asp

hongjun
When you move to Asp.Net Access will require a dsnless connection.  In the meantime it will be helpful to do the following.
On your own local machine go to the control panel and select the ODBC or ODBC32 applet.  Create a "File DSN" for the database relative to where it is located on your system.  This will create a file with the extension .dsn and all the information you need will be in that file.
[ODBC]
Driver = Jet 3.51 or Access 97
UID = sa
PWD = ""
DataSource = c:\\\\somewhere.

Copy and past into your asp page.

Now change the datasource to read
Data Source="+Server.MapPath("nameofaccessfile.mdb")
and concatenate it to your connection string.

String strConn = "Provider = Microsoft.jet.OLEDB 3.51; uid=sa; pwd=; Data Source="+Server.MapPath("nameofaccessfile.mdb")

All on one line or break it up as you please.

There is one hitch to this.  You need to know what version of MDAC is running on the server, the example is MDAC 2.5.  Does your ISP have a customer info area on their site?  Check it out, very often they will supply you when the necessary information for free.

Hope this helps.