PDA

View Full Version : Microsoft OLE DB Provider for ODBC Drivers error '80004005'


m_minten
03-24-2009, 09:28 PM
I am having a problem setting up a database connection with my website. I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

/opneverforget/index.asp, line 9

I am pretty new to this so any help would be appreciated.

I believe this is my connection string:

1 <%
2 ' FileName="Connection_odbc_conn_dsn.htm"
3 ' Type="ADO"
4 ' DesigntimeType="ADO"
5 ' HTTP="false"
6 ' Catalog=""
7 ' Schema=""
8 Dim MM_connOpNF_STRING
9 MM_connOpNF_STRING = "dsn=access_OpNvrForget;"
10 %>

or maybe problem is in the actual page:

1 <%@LANGUAGE="VBSCRIPT"%>
2 <!--#include file="../Connections/connOpNF.asp" -->
3 <%
4 Dim rsSoldier
5 Dim rsSoldier_cmd
6 Dim rsSoldier_numRows
7
8 Set rsSoldier_cmd = Server.CreateObject ("ADODB.Command")
9 rsSoldier_cmd.ActiveConnection = MM_connOpNF_STRING
10 rsSoldier_cmd.CommandText = "SELECT Name, Age, Hometown, DeathDate, Street, Project, Link1, Link2, Bio, Image FROM tblSoldiers ORDER BY DeathDate ASC"
rsSoldier_cmd.Prepared = true

Set rsSoldier = rsSoldier_cmd.Execute
rsSoldier_numRows = 0

Old Pedant
03-24-2009, 10:07 PM
So *DO* you have a DSN of that name set up on that server???

If you had it working on your own machine and then uploaded the pages to a web server, you would have had to set up a DSN with the *same name* pointing to the same DB for your code to work.

It's another good reason to *NOT* use a DSN if you can avoid it.

FWIW, I see nothing wrong with the code, per se. From either file. So it's almost surely because the given DSN does not exist on that server. Or the DSN exists and is set up wrong.

You'd really be far far better off going with a DSN-less connection and using the JET OLEDB driver (assuming this is an Access or CSV or similar database) than using a DSN. And if it happens to be SQL Server or some other DB, you *really* don't want to use a DSN.

shakir
03-29-2009, 03:53 PM
I thing the problem on "dsn=access_OpNvrForget"

set the dsn connection again with actual path

Old Pedant
03-29-2009, 09:30 PM
Okay, this post is only FIVE DAYS after the post I gave that says EXACTLY THE SAME THING. *sigh*