rick101396
asked on
Error: Data source name not found and no default driver specified
Have anyone experienced this error message or know why it appears?
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/fps/formpubsForm.asp, line 455
I created an ASP to access a database on my local web server using Visual InterDev. My global.asa file is able to connect to the database but everytime I try to view the records from IE I get the error message above. The line number that the error message is referring to is the "formpubsFileDSN.Open " command line shown below:
<%
Set formpubsFileDSN = Server.CreateObject("ADODB .Connectio n")
formpubsFileDSN.Connection Timeout = Session("formpubsFileDSN_C onnectionT imeout")
formpubsFileDSN.CommandTim eout = Session("formpubsFileDSN_C ommandTime out")
formpubsFileDSN.Open Session("formpubsFileDSN_C onnectionS tring"), Session("formpubsFileDSN_R untimeUser Name"), Session("formpubsFileDSN_R untimePass word")
Set cmdTemp = Server.CreateObject("ADODB .Command")
Set rs = Server.CreateObject("ADODB .Recordset ")
cmdTemp.CommandText = "SELECT `EDC_Code`, `EDC_Name`, `EDC_Modified`, `EDC_Comment` FROM `EDC_Forms`"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = formpubsFileDSN
rs.Open cmdTemp, , 0, 1
%>
I have installed and reinstalled Visual Studio, Front Page Extension, Active Server Page and IIS 4.0 but there was no luck. Any assistant is most appreciated.
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/fps/formpubsForm.asp, line 455
I created an ASP to access a database on my local web server using Visual InterDev. My global.asa file is able to connect to the database but everytime I try to view the records from IE I get the error message above. The line number that the error message is referring to is the "formpubsFileDSN.Open " command line shown below:
<%
Set formpubsFileDSN = Server.CreateObject("ADODB
formpubsFileDSN.Connection
formpubsFileDSN.CommandTim
formpubsFileDSN.Open Session("formpubsFileDSN_C
Set cmdTemp = Server.CreateObject("ADODB
Set rs = Server.CreateObject("ADODB
cmdTemp.CommandText = "SELECT `EDC_Code`, `EDC_Name`, `EDC_Modified`, `EDC_Comment` FROM `EDC_Forms`"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = formpubsFileDSN
rs.Open cmdTemp, , 0, 1
%>
I have installed and reinstalled Visual Studio, Front Page Extension, Active Server Page and IIS 4.0 but there was no luck. Any assistant is most appreciated.
I am not sure about your particular set-up for your ASP pages so I hope my comments are relevant.
"Data source name not found and no default driver specified"
this sounds like you are trying to open a connection to the database but IIS does not know / cannot find the data source name to use to open the database with.
This line of code here
formpubsFileDSN.Open Session("formpubsFileDSN_C onnectionS tring")
means use the given Connection Object (in your case formpubsFileDSN) and open a connection to the database indicated by the data source name which follows.
You are using a Session variable. Why you want to do that I don't know. A different Session object is kept for every user that visits your ASP pages - so assuming it's always the same database you want to access you are going to need to set that session variable to be equal to the name of the database as you set it up using the ODBC Data Source Administrator.
(I hope that I'm not telling you stuff you already know but
this is the first thing I thought of after reading your problem
description.)
I suggest you modify the aforementioned line of code by removing the reference to the Session Object variable (it is just one more layer of complexity to muck stuff up.) After you get the ASP page working to your satisfaction you can come back and re-insert the reference to the Session Object (assuming that's how you want to do it.)
Anyways, I suggest you do something like this
formpubsFileDSN.Open "fluffy"
(this will work assuming you named your database 'fluffy'
in the ODBC Administrator.)
If you have already taken care to specify the name of your database by setting a value for ("formpubsFileDSN_Connecti onString")
then Oops, sorry. I guess I did not understand your question.
By the way, all my comments reference the IIS ASP ADO
Connection Object Methods and Properties,
specifically
connection.Open ConnectionString, User, Password
"Data source name not found and no default driver specified"
this sounds like you are trying to open a connection to the database but IIS does not know / cannot find the data source name to use to open the database with.
This line of code here
formpubsFileDSN.Open Session("formpubsFileDSN_C
means use the given Connection Object (in your case formpubsFileDSN) and open a connection to the database indicated by the data source name which follows.
You are using a Session variable. Why you want to do that I don't know. A different Session object is kept for every user that visits your ASP pages - so assuming it's always the same database you want to access you are going to need to set that session variable to be equal to the name of the database as you set it up using the ODBC Data Source Administrator.
(I hope that I'm not telling you stuff you already know but
this is the first thing I thought of after reading your problem
description.)
I suggest you modify the aforementioned line of code by removing the reference to the Session Object variable (it is just one more layer of complexity to muck stuff up.) After you get the ASP page working to your satisfaction you can come back and re-insert the reference to the Session Object (assuming that's how you want to do it.)
Anyways, I suggest you do something like this
formpubsFileDSN.Open "fluffy"
(this will work assuming you named your database 'fluffy'
in the ODBC Administrator.)
If you have already taken care to specify the name of your database by setting a value for ("formpubsFileDSN_Connecti
then Oops, sorry. I guess I did not understand your question.
By the way, all my comments reference the IIS ASP ADO
Connection Object Methods and Properties,
specifically
connection.Open ConnectionString, User, Password
Visual Interdev produces almost unreadable "wizard code".
If you post your global.asa, i can try and make better readble (and debuggable) code.
Anyway, it seems that or that your global.asa is not ok, or (most likely) you don't have the ODBC connection created. At least that is what the error message says.
What is the value of
- Session("formpubsFileDSN_C onnectionS tring")
- Session("formpubsFileDSN_R untimeUser Name")
- Session("formpubsFileDSN_R untimePass word")
You can display them by
Response.write Session("formpubsFileDSN_C onnectionS tring") & "<br>"
If you post your global.asa, i can try and make better readble (and debuggable) code.
Anyway, it seems that or that your global.asa is not ok, or (most likely) you don't have the ODBC connection created. At least that is what the error message says.
What is the value of
- Session("formpubsFileDSN_C
- Session("formpubsFileDSN_R
- Session("formpubsFileDSN_R
You can display them by
Response.write Session("formpubsFileDSN_C
ASKER
2718
Thanks for your help. I was able to resolve the problem by using Visual InterDev 1.0's "Data Form Wizard" to create an connection as an example. You are right, the session variables are not needed. However, I have one quick question to ask about the setting the Connection_String by using relative pathnames rather than direct pathnames.
Since I created the connection on my local server, I could set the ConnectionString as:
"DBQ=C:\InetPub\wwwroot\us bccae2\dat a\database \formpubs. mdb;Defaul tDir=C:\In etPub\wwwr oot\usbcca e2\data\da tabase;Dri ver={Micro soft Access Driver (*.mdb)}"
However, I'd like to use relate pathname to the database file on the remote server and have it look something like the following:
"DBQ=..\data\database\form pubs.mdb;D efaultDir= ..\data\da tabase;Dri ver={Micro soft Access Driver (*.mdb)}"
But I get the following message appears when I load the ASP with the ralative pathnames:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access 97 Driver] '(unknown)' isn't a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
I figure that by using ralative pathnames, the database is more portable and I don't have to know the direct pathnames to the database directories on the remote servers.
Please suggest the proper method to use for connecting the the database using relative pathnames...even if you don't know, submit your reply as a "proposed answer" and I will allocate the points to you for helping me with my previous question.
Thanks for your help. I was able to resolve the problem by using Visual InterDev 1.0's "Data Form Wizard" to create an connection as an example. You are right, the session variables are not needed. However, I have one quick question to ask about the setting the Connection_String by using relative pathnames rather than direct pathnames.
Since I created the connection on my local server, I could set the ConnectionString as:
"DBQ=C:\InetPub\wwwroot\us
However, I'd like to use relate pathname to the database file on the remote server and have it look something like the following:
"DBQ=..\data\database\form
But I get the following message appears when I load the ASP with the ralative pathnames:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access 97 Driver] '(unknown)' isn't a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
I figure that by using ralative pathnames, the database is more portable and I don't have to know the direct pathnames to the database directories on the remote servers.
Please suggest the proper method to use for connecting the the database using relative pathnames...even if you don't know, submit your reply as a "proposed answer" and I will allocate the points to you for helping me with my previous question.
The easiest thing is to make an ODBC connection to the database and use that to connect to the database. Then the only thing you need to do when moving the site to another server, is to create an ODBC connection on the new server.
To create a connection to an ODBC Access database, you only need 2 lines:
Set Conn = Server.CreateObject("ADODB .Connectio n")
Conn.Open "DSN=YourODBCName"
To create a connection to an ODBC Access database, you only need 2 lines:
Set Conn = Server.CreateObject("ADODB
Conn.Open "DSN=YourODBCName"
i think you the access database needs to be located on the web server. Its a bug..
ASKER
sybe
I am hoping to create a DSNless connnection. The reason is because I can only access the virtual directory of my web site on the server and also I don't want to have to ask the systems admin to add create the ODBC connection for me each time. What I wanted to do was to create an UNC pathname as a connection to my database. That way I could transport the database anywhere and I would only need to make some minimal changes.
I hope I didn't go off track from what you were saying. thanks for the ideas.
I am hoping to create a DSNless connnection. The reason is because I can only access the virtual directory of my web site on the server and also I don't want to have to ask the systems admin to add create the ODBC connection for me each time. What I wanted to do was to create an UNC pathname as a connection to my database. That way I could transport the database anywhere and I would only need to make some minimal changes.
I hope I didn't go off track from what you were saying. thanks for the ideas.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER