Tuesday, June 17, 2008

Compiling DBD::ODBC on Vista and XP

Background
On my machine(s), I need to use the Unicode-enabled version (specifically, the UTF-16 enabled version) of DBD::ODBC that is distributed on CPAN. However, the default packages distributed and installed by ActiveState Perl is not unicode enabled (tested up to v1.15).

Previously, I have successfully installed my own copy after Googling the web intensively for a day or two and compiling / testing / tweaking the information found on the articles online.

I have decided to post the steps here to "keep a copy" in case I need it again and I can't find it on my harddisk. I was lucky I made notes the previous time, otherwise I would have spent another day or two going through the same stuff again.


Systems / Setups tested against
  1. Windows Vista Business Edition x86, ActiveState Perl v5.8.8
  2. Windows 2003 Server x64, ActiveState Perl v5.8.8 (v5.10 is too buggy for me, esp the x64 edition)

Prerequisites
  1. Make sure you have VS.Net 2005/2008 installed and working. If not, I guess the Windows SDK with the VC++ compiler and headers is a viable alternative (not 100% tested on using Win SDK only).
  2. Make sure your SQL Server 2005 (Express or otherwise) is installed, working, and is patched (ODBC v1.16 fails with unpatched version of MSSQL 2005 due to the "old" SQL client driver provided).
  3. Create an ODBC connection with proper user credentials and permissions on the database for testing (as part of the ODBC installation procedure).
  4. Make sure the PERL modules (eg, DBI) are installed and updated using the PPM (perl package manager).

Procedure

  1. Download and unpack DBD::ODBC from http://search.cpan.org/~mjevans/DBD-ODBC-1.16/
  2. Start the Visual Studio 200X command prompt, navigate to the directory where the module sources are unpacked in Step 1.
  3. Set the ODBC connection parameters with valid information:
    1. set DBI_DSN=dbi:ODBC:test_db
    2. set DBI_USER=user
    3. set DBI_PASS=pass
  4. Run "perl Makefile.PL"
  5. Run "nmake"
  6. Run "nmake manifest"
  7. Run the following command as a single line:
    mt -manifest blib\arch\auto\DBD\ODBC\ODBC.dll.manifest -outputresource:blib\arch\auto\DBD\ODBC\ODBC.dll;#2
  8. Run "nmake test"*, check for errors or problems at this step.
  9. If nothing goes wrong, run "nmake install"**

* Note: The outpuyt from my "nmake test" step looks like this:
D:\tmp\DBD-ODBC-1.16\DBD-ODBC-1.16>nmake test

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

D:\Perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'bl
ib\lib', 'blib\arch')" t/*.t
t/01base................ok
t/02simple..............ok 1/62#
# Using DBMS_NAME 'Microsoft SQL Server'
# Using DBMS_VER '09.00.3042'
# Using DRIVER_NAME 'SQLNCLI.DLL'
# Using DRIVER_VER '09.00.3042'
t/02simple..............ok
t/03dbatt...............ok 3/26#
# N.B. Some drivers (postgres/cache) may return ODBC 2.0 column names for the SQ
LTables result-set e.g. TABLE_QUALIFIER instead of TABLE_CAT
t/03dbatt...............ok
t/05meth................ok
t/07bind................ok
t/08bind2...............ok
t/09multi...............ok
t/10handler.............ok
t/20SqlServer...........ok
t/30Oracle..............ok
2/4 skipped: Oracle tests not supported using Microsoft SQL Server
t/40UnicodeRoundTrip....ok
t/41Unicode.............ok
All tests successful, 2 subtests skipped.
Files=12, Tests=299, 24 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU)




** Note: The output from my "nmake install" step looks like this:

D:\tmp\DBD-ODBC-1.16\DBD-ODBC-1.16>nmake install

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation. All rights reserved.

Installing D:\Perl\site\lib\auto\DBD\ODBC\ODBC.bs
Installing D:\Perl\site\lib\auto\DBD\ODBC\ODBC.dll
Installing D:\Perl\site\lib\auto\DBD\ODBC\ODBC.dll.manifest
Installing D:\Perl\site\lib\auto\DBD\ODBC\ODBC.exp
Installing D:\Perl\site\lib\auto\DBD\ODBC\ODBC.lib
Installing D:\Perl\site\lib\auto\DBD\ODBC\ODBC.pdb
Installing D:\Perl\html\site\lib\DBD\ODBC.html
Installing D:\Perl\html\site\lib\DBD\ODBC\Changes.html
Installing D:\Perl\html\site\lib\DBD\ODBC\FAQ.html
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree
Installing D:\Perl\site\lib\DBD\ODBC.pm
Installing D:\Perl\site\lib\DBD\ODBC\Changes.pm
Installing D:\Perl\site\lib\DBD\ODBC\FAQ.pm
Appending installation info to D:\Perl\lib/perllocal.pod

Wednesday, May 14, 2008

Intgeration issues? Just Smook 'em together!

Just saw this interesting project being mentioned in TSS:
http://www.theserverside.com/news/thread.tss?thread_id=49313

Really like the features once I see them, hope it goes well, like the other interesting projects at codehaus.

Smooks can be used to:

  • Perform a wide range of Data Transforms - XML to XML, CSV to XML, EDI to XML, XML to EDI, XML to CSV, Java to XML, Java to EDI, Java to CSV, Java to Java, XML to Java, EDI to Java etc.
  • Populate a Java Object Model from a data source (CSV, EDI, XML, Java etc). Populated object models can be used as a transformation result itself, or can be used by (e.g.) Templating resources for generating XML or other character based results. Also supports Virtual Object Models (Maps and Lists of typed data), which can be used by EL and Templating functionality.
  • Process huge messages (GBs) - Split, Transform and Route message fragments to JMS, File, Database etc destinations.
  • Enrich a message with data from a Database, or other Datasources.
  • Perform Extract Transform Load (ETL) operations by leveraging Smooks' Transformation, Routing and Persistence functionality.
Looks great for those very "interesting" integration projects between legacy system A and legacy system B. Will have to keep it in mind if I ever encounter such requirements in future projects.

Check it out at:
http://milyn.codehaus.org/Smooks

Monday, May 12, 2008

Unscrupulous scammers

Those conmen who call up parents claiming to have kidnap their kids should be dealt with the same way kidnappers are dealt with, by caning, fine, jail and deportation if they are illegal immigrants.

'The first thing I heard was a man say in Mandarin 'Lao Siong (brother), I kidnapped your son.'

http://tnp.sg/news/story/0,4136,164397,00.html