32-bit connection on 64-bit Win7, IIS 7.5 help needed [Answered]RSS

3 replies

Last post Jan 28, 2013 02:00 PM by Pluto is a Planet

  • 32-bit connection on 64-bit Win7, IIS 7.5 help needed

    Aug 10, 2012 11:16 AM|rfranzel|LINK

    Hi.  I am very frustrated and would appreciate any advice or suggestions you might have.  I have a very common problem, but I've done a lot of research and tried everything I can think of to resolve it, but it persists.

    The problem is that I am receiving the error, "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" on the Open Method call to a connection to a local Access database.

    I have replaced my old Windows XP system (IIS 6, IE8, MS Access 2007) with a Windows 7 Home Premium 64 bit system (IIS 7.5, IE9, MS Access 2010).  I'm using VB Script within ASPX webpage.  Here's the code that is throwing the exception (pretty straightforward):

    <%
    ' Define and open Connection
     dsnBookToc = Server.CreateObject("ADODB.Connection")
     dsnBookToc.open (Application("dsnBookToc_ConnectionString"))
    %>

    This is what I've done so far:
     1. Run as administrator the 32-bit ODBC Manager located at C:\Windows\SysWOW64\odbcad32.exe to create the dsn
     2. Verified that the driver existed at C:\PROGRA~2\COMMON~1\MICROS~1\OFFICE14\ACEODBC.DLL
     3. Granted full access permission to the access database file, and then the directory it's in to Users and IIS_IUSRS
        Granted full access permission to the Temp and Tmp folders
     4. Set DefaultAppPool and Classic .NET AppPool Enable 32-Bit Applications to True
     5. Set DefaultAppPool and Classic .NET AppPool Enable Load User Profile to False (Actually tried it both ways)
     6. Set permissions to Full Control to HKLM\SOFTWARE\Wow6432Node\ODBC for Users and IIS_IUSRS
     7. Set permissions to Full Control to HKLM\SOFTWARE\ODBC for Users and IIS_IUSRS
     8. Manually copied the key for dsnBookToc from HKLM\SOFTWARE\Wow6432Node\ODBC\ODBBC.INI to HKLM\SOFTWARE\ODBC\ODBC.INI including the Engines and Jet Sub-keys and their values
     9. Created the binary keys initial as DWORD in HKLM\SOFTWARE\ODBC\ODBC.INI, and then changed them to QWORD when it didn't work
     10. Changed the toc.asp file to toc.aspx
     And then, because nothing I tried made any difference I
     11. Converted the database from Access 2007 (*.mdb) to Access 2010 (*.accdb)

    The connection seems to exist properly.  I created the following test script I called ConnTest.vbs:
       Const adOpenStatic = 3
       Const adLockOptimistic = 3
       Const adUseClient = 3

       Set objConnection = CreateObject("ADODB.Connection")
       Set objRecordset = CreateObject("ADODB.Recordset")

       objConnection.Open "DSN=dsnBookToc;"
       objRecordset.CursorLocation = adUseClient
       objRecordset.Open "SELECT count(*) FROM ManChapterToc" , objConnection, _
           adOpenStatic, adLockOptimistic
       objRecordSet.MoveFirst
       Wscript.Echo objRecordSet.RecordCount
       objRecordset.Close
       objConnection.Close

    When I run this script (double-click on it) I receive the Data source name not found.... error, but when I force it to run in 32-bit mode (c:\windows\SysWow64\cscript ConnTest.vbs) it works.

    A possibly related and baffling thing is that when I create the dsn with the ODBC Manager, and select the database and then click OK, the utility goes straight back to the System DSN tab as opposed to the summary screen with the test connection button that I've seen in the past, and the Apply button is grayed.  The registry does get updated however at HKLM\SOFTWARE\Wow6432Node\ODBC\ODBBC.INI.

    I am at a loss, and would appreciate any ideas. Thanks.

  • Re: 32-bit connection on 64-bit Win7, IIS 7.5 help needed

    Aug 10, 2012 03:58 PM|rfranzel|LINK

    A little more information:

    In the IIS Manager, looking at the Modules section for the website, all the modules point to the System32\inetsrv directory rather than the SysWOW64\inetsrv directory even though the app pool all are set to Enable 32-Bit Applications: True.

    I can't seem to change them (they're locked). Can that be the problem?

  • Re: 32-bit connection on 64-bit Win7, IIS 7.5 help needed

    Aug 17, 2012 05:28 AM|Mamba Dai - MSFT|LINK

    Hi,

    rfranzel

    When I run this script (double-click on it) I receive the Data source name not found.... error, but when I force it to run in 32-bit mode (c:\windows\SysWow64\cscript ConnTest.vbs) it works.

    Since it's 32 bit ODBC driver, so you need to configure your web application to 32-bit mode:

    http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/dfbd0406-bc69-436e-998b-7fc454012f91

    http://social.msdn.microsoft.com/Forums/en/adodotnetdataproviders/thread/1c63e3ae-e001-4066-9eac-ad9162116603

    http://social.msdn.microsoft.com/Forums/en-IE/sqldataaccess/thread/685eacc1-a670-42d4-8392-924230fa90cb

    BTW, some tips for you:

    32-bit applications will only see ODBC connections created in the 32-bit side, and 64-bits applications will only see ODBC connections from the 64-bit side. Each kind of application has is own registry.To setup DSN for 32-bit application you must use:
    %WINDIR%\SysWOW64\odbcad32.exe
    and for 64-bit application you must use:
    %WINDIR%\System32\odbcad32.exe

    Please mark the replies as answers if they help or unmark if not.
    Feedback to us



  • Re: 32-bit connection on 64-bit Win7, IIS 7.5 help needed

    Jan 28, 2013 02:00 PM|Pluto is a Planet|LINK

    Googootz

    However, a clarification - open IIS manager > click Application Pools (under connections on the LH side) then > click Set Application Pool Defaults (under actions on the RH side) expand the General items and change Enable 32-Bit Applications to TRUE

    Yay this is the solution for me! I was able to create my own 32-bit DSN connection, but when I connected to it, I got the "[Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application" error. I'm running Windows 8 64-bit and was trying to connect to an *.MDB Access database in a Classic ASP page. This did it for me!

    On the second link that was provided.