Data source name not found and no default driver specified

Discussion in 'ASP.NET WebServices' started by michaelsims, Dec 13, 2006.

  1. 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
     
  2. SQL 2005, however I think it was written in SQL 2000
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    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
     
  4. 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


    %>
     

Share This Page