I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-07-31 14:09:38-07 by neal
DBD:ODBC connections on 64bit versions of Windows under Cygwin

Posting this information here as it took me a while to figure it out and might help others in the same situation.

Aim: Trying to get DBD::ODBC installed and connecting to ODBC sources on the 64bit version of Windows 2003 Standard (it's the use of the 64bit version that is the salient point here).

Problem: After setting up a System DSN datasource (to a SQLServer DB in this case) in the "Data Sources (ODBC)" manager in Windows and verifying that it could connect okay I was failing to connect to it via DBD::ODBC with the message:

"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (SQL-IM002)"

Solution: It turns out that there are two ODBC managers in 64bit Windows, on for 64bit applications and one for 32bit applications. The manager for 64bit applications is the one that appears when selected from the Start->Administrative Tools->Data Sources (ODBC) menu item. The one that DBD::ODBC will access via the ws32api library is the 32bit manager.

You can access the 32bit manager by running %WINDOWS%\SysWOW\odbcad32.exe

If you set up your datasource in that manager then DBD::ODBC will be able to connect to it (the datasource will not show up in the 64bit manager which could prove mysterious to anyone else administering the server!).

Related: On a related note (and I'm not sure if this is Windows 64bit specific or not), if you find that you can't install DBD::ODBC under Cygwin in the first place because Makefile.PL is failing it may be that you haven't yet set up an ODBC datasource. The Makefile.PL is looking for %WINDOWS%\ODBC.INI in order to decide that it should set itself up to use the Windows ODBC driver. If it doesn't find it Makefile.PL will fail saying that it can't identify a driver:

The DBD::ODBC module needs to link with an ODBC 'Driver Manager'. (The Driver Manager, in turn, needs one or more database specific ODBC drivers. The DBD::ODBC module does _not_ include any ODBC drivers!) You need to indicate where your ODBC Driver Manager is installed. You can do this ether by setting the ODBCHOME environment variable or by running 'perl Makefile.PL -o odbcdir'.

However, the ODBC.INI file doesn't exist until an ODBC datasource it created. So, you can't install DBD::ODBC first and then create your first ODBC datasource. You need to create a datasource first (or at least create an empty ODBC.INI file).

Direct Responses: 8464 | Write a response