Click to See Complete Forum and Search --> : SQL connection


peachy
05-30-2004, 11:15 PM
I am trying to connect to a SQL database via ASP. Have done this one time before and it worked fine, but I have slept since then and now have a brain fade.
Using:

dim objConn,strConnection
strConnection = "DSN=DSN_name;UID=User_ID;PWD=Password"
set objConn = server.CreateObject("ADODB.Connection")
objConn.connectionstring = strConnection
objconn.Open

The error I am getting is:

[Microsoft][ODBC Driver Mager] Datasource name not found and no default driver specified.

Nrmally I program in RPG but this is a special project I have to get done, Please someone let me know "what" I am missing

Peachy:confused:

buntine
05-31-2004, 02:05 AM
Your trying to connect to a DSN that does not exist. In this case, its 'dsn_name'. DSN stands for Data Source Name.

You can connect to a database with a dsn-less connection. Though, i would look in your control panel and see if you have a DSN set up. If not, just create one.

Regards,
Andrew Buntine.

peachy
05-31-2004, 10:41 AM
The database has a DSN.
I think the problem occurred because there was a database, I created a new one without deleting the old one, then deleted both and recreated the new one. The new database has a different name, userid and password. Maybe my provider needed to be contacted to reset something.
Anyway I finally got connected late last night by using a DSN-less connection that I found at wwww.aspfaq.com.
Thanks responding:)

NCit
06-01-2004, 12:51 PM
I also advise you to connect DSN-Less. Below is a good article about DSN vs. DSN-Less

http://www.4guysfromrolla.com/webtech/070399-1.shtml

Happy programming...