Friday, May 25, 2012

Microsoft Text Driver on Windows 2008 R2

I had to set up Microsoft Text Driver on Windows 2008 R2 64-bit machine and was constantly getting errors. Here's what I had to go through to get this to work:

There are 2 different versions of the ODBC drivers on Windows 2008 R2 - 64 bit version and a 32-bit version. When you open the ODBC Datasource Administrator Tool from "Administrative Tools> Datasources (ODBC)", its the 64 bit version that gets opened. I tried to create a DSN using a text driver but did not find the text driver in the list of drivers. So initially I thought that the text drivers were not installed. But when I searched for the msjet40.dll file I did find it in the c:\Windows\SysWOW64 directory. Refer
So this indicated to me that a 32-bit version of the driver was available. This KB article from Microsoft confirmed this:

So I found the 32-bit version of the ODBC Administrator. This is located at: C:\Windows\SysWOW64\Odbcad32.exe

Once I open this file, it opened the 32bit ODBC Administrator interface and it did have the Microsoft text driver listed in there. So I added my datasource and changed my file extensions to use only *.csv.

Now that the datasource was created, I tried to use it. But it threw the following error:
[ODBC Text Driver] Invalid setting in Excel key of the Engines section of the Windows Registry. I was stumped. After much searching on the Internet, nothing seemed to work.
So as a last resort I deleted the datasource and added a brand new one. This time, I left the defaults and it just worked. So I tried it one more time and created the datasource with the file extensions set to *.csv only. it again did not work and threw the same error. Now when I went to edit the file extensions, I saw that the *.csv had been mangled to some weird characters. *.%^767 or something like that. I tried different file extensions but none worked.
So finally to get this to work, I had to leave it to use *.* as the list of file extensions.

Installing ColdFusion MX7 on Windows 2008 R2 64bit

Trying to install ColdFusion MX7 on Win 2008 R2 was giving me all sorts of errors. The server installed without any issues but IIS sites could not be configured to server up cfm pages.

There were a couple of things I had to do to get this to work.

Enabled IIS6 features on Win2008 machine as follows:

  • Control Panel > Programs and Features > Turn Windows Features On or Off >
  • This will open the "Server Manager".
  • Expand Roles>Web Server>
  • On right panel, under "Summary>Role Services>" click on "Add Role Services".
  • In the "Add Role Services" window, select all options under "Management Tools>IIS 6 Management Compatibility"
  • Click on Install.

Change AppPool for the Website to 32-bit

  • Open IIS Manager
  • Expand MachineName> Application Pools>
  • Right click on AppPool name (eg: DefaultAppPool) and select "Advanced Settings"
  • Change "Enable 32-bit Applications" to "true". Click OK

Configure Websites to Run ColdFusion pages

I ran the Web Server Configuration Tool, added a site and got the following error message "Version 7.5 is installed. Supported versions are 4.x, 5.x, 6.x". Basically, Windows 2008 R2 has IIS7.5 and the Web server configuration tool that comes with ColdFusion MX7 was created before IIS7 was created and so it does not support it. So the alternative was to configure the sites manually to run with ColdFusion. This is where I got some help from Sameer of His post ColdFusion Manual Configuration was very helpful.

  • Open \runtime\servers\coldfusion\SERVER-INF\jrun.xml . Find “ProxyService” and change value of deactivated to "false"
  • Restart ColdFusion
  • Create file: \cfroot\untime\ib\sconfig\
  • Edit it as follows:
  • Save the file

  • Extract files from wsconfig.jar into a temp directory
  • Copy jrunwin32.dll and jrun_iis6.dll from extracted files to cfroot\runtime\lib\wsconfig\.
  • Copy jrun_iis6_wildcard.dll from extracted files to cfroot\runtime\lib\wsconfig\1.

  • Create the file cfroot\runtime\lib\wsconfig\1\jrun_iis6_wildcard.ini. Edit it as follows:  

Notes: bootstrap port number for ColdFusion 9 is 51800, for ColdFusion 7 and 8 port number is 51011, for ColdFusion 6 the port number is 51010. 
  • Create the file in cf_root\runtime\lib\wsconfig\1. Edit as follows: 

Note: for MX 6.1; for MX 7/8; for MX9

  • Under the IIS Management Console, click on your computer name, click on "ISAPI and CGI Restrictions" and add two entries: 
one for cfroot\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll and the other for cfroot\runtime\lib\wsconfig\jrun_iis6.dll. Set permission for both to "allowed". 
You can give whatever name you want; something like "Macromedia Server Extensions"

  • Click on your computer name and click on “Handler Mappings” and add one "Wildcard Script Map" with foll. params:
    Requestpath:  * 
    Executable:  C:\CFusionMX7\runtime\lib\wsconfig\1\jrun_iis6_wildcard.dll
  • After adding wildcard script map, add script handlers for *.cfm files with foll. params:
Request Path: *.cfm
  • Similarly add handler for *.cfc files 
  • Just to be sure, restart ColdFusion as well as IIS. And you should be all set.