otijim has asked for the wisdom of the Perl Monks concerning the following question:

I have ActivePerl (win32) script that connects to an informix database though the WIN32::ODBC module. It works pretty good. Now I want to move this script to an HP-Unix box. How do I port the ODBC script since I'm not on a WIN32 box (and I assume I won't be able to use the WIN32 module)???

Replies are listed 'Best First'.
RE: ODBC and UNIX
by Kanji (Parson) on Nov 15, 2000 at 23:14 UTC

    Have you looked at the DBI and DBD::ODBC modules? They're not platform specific, and using DBI would have the added benefit of making your script (theoretically) database independant, just by changing the DSN.

    update:
    As noted below, DBD::Informix is also an option.

      Okay...Thanks for all the info. I'm such a newby. Anyhow, does the DBD::ODBC need DSN string setup...this is kind of where I'm stuck... In windows you just load of the ODBC control panel and fill in the blanks.

      Where do find docs on how to get this done?


      Give a man a fish and he'll eat for a day. Teach a man
      to fish and he'll eat for a life time.
RE: ODBC and UNIX
by wardk (Deacon) on Nov 15, 2000 at 23:40 UTC

    otijim,

    You will need to purchase ODBC drivers for HPUX. Also check to make sure you have the ANSI C libraries for HPUX, this is also something that has to be purchased (the included HPUX compiler is not ANSI standard, it will essentially compile a kernel). You will also need to be sure that all the 4GL libraries (esql?) for informix are also installed. (and there is (used to be) a required install order with informix, with 4GL requiring to be installed prior to Informix itself.

    In a previous lifetime, I attempted to get Perl, DBI and Informix to play together, but experienced numerous problems getting DBI compiled (DBD/DBI, HPUX and Informix seemed to be inherently problematic at the time, based on dbi-user posts). You'll likely benefit from subscribing to the dbi-users maillist.

    My story ended sadly perl-wise, I never got it working and had to use 4GL for my work. I hope your story has a much happier ending!

    good luck!

      I believe you can get the same results with gcc on HP/UX, and using the native Informix drivers, not ODBC or 4GL. This worked fine for me with Ingres, and also Informix on SCO unix. Just install gcc (available as binaries from hp), then DBI and DBD::Informix from CPAN...
RE: ODBC and UNIX
by BigJoe (Curate) on Nov 16, 2000 at 00:13 UTC
    My suggestion is look at using DBD::Informix. This may be a little easier that getting ODBC installed. You should find that using the DBI is better for doing ports. You can also look at DBI which is a standard perl interface with most databases even through ODBC.

    --BigJoe

    Learn patience, you must.
    Young PerlMonk, craves Not these things.
    Use the source Luke.
RE: ODBC and UNIX
by PsychoSpunk (Hermit) on Nov 16, 2000 at 00:16 UTC
    Well, since it looks like you'd have to move to DBI anyway (which will entail rewriting some of the code...), you might also want to look at DBD::Informix which will give you a native connection to the database.

    I guess this begs a larger question. Are the APIs of DBI and Win32::ODBC similar enough to do a simple replace on any Win32::ODBC calls to make them DBI calls? If you can't, then why would Win32::ODBC still be useful? I understand the history (and if you know you will never move the Perl to a non-Win32 machine, Win32::ODBC will be a better choice than DBD::ODBC), but it seems that DBI would always be the better choice in most solutions.

    This is only my opinion, and I want someone to tell me if I'm wrong for thinking this way.

    ALL HAIL BRAK!!!