PDA

View Full Version : Data source name not found and no default driver specified


michaelsims
12-13-2006, 09:53 AM
I migrated my website over from another host and I now get the error messages:



Microsoft OLE DB Provider for ODBC Drivers error '80004005'


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


/Default.asp, line 28





which means I have to change the logon strings in the /connections/ files? Right?





Well here is some sample code that seems to be pretty consistient with the 3 files I have in the connections section:





<%
' FileName="Connection_odbc_conn_dsn.htm"
' Type="ADO"
' DesigntimeType="ADO"
' HTTP="false"
' Catalog=""
' Schema=""
Dim MM_nextchicago_STRING
MM_nextchicago_STRING = "dsn=nextchicago;uid=XXXX;pwd=XXXXXXXX;"
%>
<%






what should the new code be written as?

Post Edited By Moderator (Joel Thoms) : 12/13/2006 10:44:54 PM GMT

joelnet
12-13-2006, 10:46 AM
What type of database are you connecting to?


Joel Thoms
DiscountASP.NET
http://www.DiscountASP.NET

michaelsims
12-13-2006, 10:52 AM
SQL 2005, however I think it was written in SQL 2000

bruce
12-14-2006, 07:04 AM
Your connection string is definitely wrong.

MM_nextchicago_STRING = "dsn=nextchicago;uid=XXXX;pwd=XXXXXXXX;"

The above line is trying to find a DSN named nextchicago which is obviously not correct.

You want to change the connection anyway because you should use OleDB rather than ODBC DSN. OleDB gives you better performance and stability.

Try switch this to

MM_nextchicago_STRING = "Provider=SQLOLEDB;Data Source=<sqlServerName>;Initial Catalog=<databaseName>;User Id=<dbUser>;Password=<dBPassword>;"



Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

michaelsims
12-16-2006, 06:16 AM
Actually, discountasp.net gave us a script which was a little more extensive than what you suggested. However, what you suggested is good!

What discountasp.net suggested is the following:




Dim cnnSimple ' ADO connection


Dim rstSimple ' ADO recordset


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


' DSNLess


cnnSimple.Open "Provider=SQLOLEDB;Data Source=sql2k503.discountasp.net;" _


&amp; "Initial Catalog=SQL2005_313358_iregmain;User Id=[username];Password=[password];" _


&amp; "Connect Timeout=15;Network Library=dbmssocn;"


Set rstSimple = cnnSimple.Execute("SELECT * FROM sysfiles")


%>


<P> Connecting to SQL DB with DSNless connection </P>


<table border="1">


<%


Do While Not rstSimple.EOF


%>


<tr>


<td><%= rstSimple.Fields(1).Value %></td>


<td><%= rstSimple.Fields(2).Value %></td>


</tr>


<%


rstSimple.MoveNext


Loop


%>


</table>


<%


rstSimple.Close


Set rstSimple = Nothing


cnnSimple.Close


Set cnnSimple = Nothing


%>