Connection string issue

Discussion in 'Windows / IIS' started by wgrasty, Jun 6, 2011.

  1. Hello,

    I'm not a developer, so please be kind :eek:

    I am trying to migrate from Windows Server 2003/IIS 6 to Windows Server 2008/IIS 7, so all I did was took all my files EXACTLY the way they were and put them on a temporary web server. I am getting this error on the pages that are trying to connect to the database:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'

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

    /inc_db_open.asp, line 9

    Here is the contents of the inc_db_open.asp file:

    <%

    dim Conn

    dim rs

    dim sql

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

    'MdbFilePath = Server.MapPath("_database/shaffermax2.mdb")

    'Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath &
    ";"

    Conn.Open "shaffermax1_db"

    Set rs = Server.CreateObject("ADODB.RecordSet")

    %>

    Here is my site URL: http://wesgrastyco.web708.discountasp.net

    Please help.
     
  2. dmitri

    dmitri DiscountASP.NET Staff

    Your site seems to be working fine. I did not see any errors when visited URL you provided. Have you resolved the issue?
     
  3. No, it's still not working. If you click on one of the links in the nav, you will see the error.
     
  4. This may be a Virtual issue in the calling ASP page.
    Can you post the section of (equipment_l_ws.asp) where it is loading that conn file?
    note: It may not call it directly, there may be a 3rd party page for the conn call.
     
  5. <!--#include file="inc_db_open.asp"-->

    <%
    <!--- Get values from database --->
    sql="SELECT id, category, subcategory, quantity, description, liquidation " _
    & " FROM equipment, category " _
    & " WHERE visible = True " _
    & " AND equipment.cat_id = category.cat_id " _
    & " AND subcategory = 'Warping & Slashing' " _
    & " ORDER BY catorder, sortorder, description"
    RS.Open sql, Conn
    %>
     
  6. I'm just guessing but there may be a problem locating that path.
    If there is you can change "file" to "virtual" or keep it with "file" and string the actual path where that include file is, i.e. <!--#include file="includes/inc_db_open.asp"-->
     
  7. Changing it to virtual did not work - same result. The include file is on the root which is where I have it. Anyone else have any ideas? I just copied an entire site from one location to another and changed nothing. If you were to do that with an asp site - what would you need to change to get it to work?
     
  8. This can get rather technical but I'm doing my best to try and help.
    There were important updates to classic asp before ASP.NET was birthed.
    One was the way pages can include things like conn strings.
    At that time I had several ASP sites with DASP and I changed everything to use the, then, newest server directives.
    One of them is the Server.Execute method.
    I'm not entirely sure but I am thinking that will work better.

    This is the way a Server.Execute command would load a conn file from a page in the site root:

    <%Server.Execute("/MyConn.asp")%>

    In every instance that worked more robustly and without errors for me.
     
  9. I will try that. Where exactly do I put that line of code?
     
  10. It's pretty easy once you get used to it but it will require you to edit some of the existing code to test this.

    Example:
    This would load a file that used to be loaded via an include statement, the entire top of the ASP page is shown...
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <%Server.Execute("/MyConn.asp")%>

    Let's say for example that you had an existing include statement like this:
    <!-- #include file="includes/version_inc.asp" -->

    To change that to use the newer Server.Execute would replace that entire line:
    <%Server.Execute("/includes/version_inc.asp")%>

    The beginning and ending "<%" and "%>" signify an entire statement.
    You don't use Server.Execute between inline tags like the original includes do.

    Hope that helps.
     
  11. That didn't work either. Anyone else have any ideas?
     

  12. Are the following really commented out or is that a result of copy paste etc:

    'MdbFilePath = Server.MapPath("_database/shaffermax2.mdb")

    'Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath &
    ";"
     
  13. Those two lines are commented out on the original site, so I think they should remain that way.
     
  14. If you can't find a developer to help you with this I'm willing to log into your site and take a look. None of us want to leave you hanging.
    All the best,
    Mark
     
  15. Thats not going to work. Effectively all you have is

    Code:
    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open "shaffermax1_db"
    
    That would work on IIS6 with a DSN setup but thats not going to work on IIS7 because you do not have a DSN. You need to un-comment the lines and instead comment out Conn.Open "shaffermax1_db" instead.
     
  16. @chuck: that worked! Thank you so much!
    @mark: thanks for the offer!

    And thanks to everyone for the suggestions and patience!
     

Share This Page