Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Installing DBD::ODBC

by Steve_BZ (Chaplain)
on Oct 18, 2009 at 15:48 UTC ( [id://801871]=perlquestion: print w/replies, xml ) Need Help??

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

Hi All

I am in the process of creating a cross-platform application and I'm now setting up Linux (Kubuntu). Everything has gone very smoothly and DBI went in like a dream from the CPAN prompt, however DBD::ODBC has not been so kind (or maybe I messed up somewhere along the way). After failing with the suggestion I should install unixODBC, which I did, from Kubuntu's KPackage, it now can't find the ODBC driver manager, and I don't know what to tell it. Here is DBD::ODBC's and CPAN's comments on the matter:

cpan[1]> install DBD::ODBC CPAN: Storable loaded ok (v2.18) Going to read '/home/steve/.cpan/Metadata' Database was generated on Sun, 18 Oct 2009 04:27:14 GMT Running install for module 'DBD::ODBC' CPAN: Data::Dumper loaded ok (v2.121_14) 'YAML' not installed, falling back to Data::Dumper and Storable to rea +d prefs '/home/steve/.cpan/prefs' + Running make for M/MJ/MJEVANS/DBD-ODBC-1.23.tar.gz + CPAN: Digest::SHA loaded ok (v5.45) + CPAN: Compress::Zlib loaded ok (v2.015) + Checksum for /home/steve/.cpan/sources/authors/id/M/MJ/MJEVANS/DBD-ODB +C-1.23.tar.gz ok + Scanning cache /home/steve/.cpan/build for sizes + ...................................................................... +......DONE CPAN: Archive::Tar loaded ok (v1.38) + Will not use Archive::Tar, need 1.00 + DBD-ODBC-1.23/ + DBD-ODBC-1.23/ConvertUTF.c + DBD-ODBC-1.23/ODBC.pm + DBD-ODBC-1.23/ODBC.h + DBD-ODBC-1.23/dbdimp.c + DBD-ODBC-1.23/README.windows + DBD-ODBC-1.23/README.sqlserver + DBD-ODBC-1.23/README.adabas + DBD-ODBC-1.23/META.yml + DBD-ODBC-1.23/dbdimp.h + DBD-ODBC-1.23/test_results.txt + DBD-ODBC-1.23/README + DBD-ODBC-1.23/unicode_helper.c + DBD-ODBC-1.23/Changes + DBD-ODBC-1.23/t/ + DBD-ODBC-1.23/t/09multi.t + DBD-ODBC-1.23/t/20SqlServer.t + DBD-ODBC-1.23/t/40UnicodeRoundTrip.t + DBD-ODBC-1.23/t/05meth.t + DBD-ODBC-1.23/t/01base.t + DBD-ODBC-1.23/t/rt_38977.t + DBD-ODBC-1.23/t/pod.t + DBD-ODBC-1.23/t/12blob.t + DBD-ODBC-1.23/t/rt_39897.t + DBD-ODBC-1.23/t/30Oracle.t + DBD-ODBC-1.23/t/07bind.t + DBD-ODBC-1.23/t/02simple.t + DBD-ODBC-1.23/t/pod-coverage.t + DBD-ODBC-1.23/t/rt_46597.t + DBD-ODBC-1.23/t/rt_43384.t + DBD-ODBC-1.23/t/UChelp.pm + DBD-ODBC-1.23/t/08bind2.t + DBD-ODBC-1.23/t/rt_null_nvarchar.t + DBD-ODBC-1.23/t/10handler.t + DBD-ODBC-1.23/t/ODBCTEST.pm + DBD-ODBC-1.23/t/rt_39841.t + DBD-ODBC-1.23/t/41Unicode.t + DBD-ODBC-1.23/t/03dbatt.t + DBD-ODBC-1.23/ConvertUTF.h + DBD-ODBC-1.23/README.osx + DBD-ODBC-1.23/examples/ + DBD-ODBC-1.23/examples/moreresults.pl + DBD-ODBC-1.23/examples/testspmulti.pl + DBD-ODBC-1.23/examples/joetest.pl + DBD-ODBC-1.23/examples/joetest5.pl + DBD-ODBC-1.23/examples/testproc.pl + DBD-ODBC-1.23/examples/leakcheck.pl + DBD-ODBC-1.23/examples/inttest.pl + DBD-ODBC-1.23/examples/sqltmptabs.pl + DBD-ODBC-1.23/examples/joetest6.pl + DBD-ODBC-1.23/examples/testproc3.pl + DBD-ODBC-1.23/examples/longbin.pl + DBD-ODBC-1.23/examples/proctest2.pl + DBD-ODBC-1.23/examples/testclob.pl + DBD-ODBC-1.23/examples/testmulti.pl + DBD-ODBC-1.23/examples/testkeys.pl + DBD-ODBC-1.23/examples/listtabs.pl + DBD-ODBC-1.23/examples/testundef2.pl + DBD-ODBC-1.23/examples/testconn.pl + DBD-ODBC-1.23/examples/Test_Dates_Jun19.pl + DBD-ODBC-1.23/examples/testdestruction.pl + DBD-ODBC-1.23/examples/proctest3.pl + DBD-ODBC-1.23/examples/timetest.pl + DBD-ODBC-1.23/examples/testerrhandler.pl + DBD-ODBC-1.23/examples/testundef.pl + DBD-ODBC-1.23/examples/testmoney.pl + DBD-ODBC-1.23/examples/money_test.cgi + DBD-ODBC-1.23/examples/testver.pl + DBD-ODBC-1.23/examples/identity.pl + DBD-ODBC-1.23/examples/northwind.pl + DBD-ODBC-1.23/examples/testcrtable.pl + DBD-ODBC-1.23/examples/proctest1.pl + DBD-ODBC-1.23/examples/coltest.pl + DBD-ODBC-1.23/examples/testxml.pl + DBD-ODBC-1.23/examples/joetest4.pl + DBD-ODBC-1.23/examples/joetest2.pl + DBD-ODBC-1.23/examples/testdatasources.pl + DBD-ODBC-1.23/examples/DbiTest.pl + DBD-ODBC-1.23/examples/testproc4.pl + DBD-ODBC-1.23/examples/cancel.pl + DBD-ODBC-1.23/examples/testundef3.pl + DBD-ODBC-1.23/examples/contest.pl + DBD-ODBC-1.23/examples/testgetinfo.pl + DBD-ODBC-1.23/examples/joetest7.pl + DBD-ODBC-1.23/examples/testigparams.pl + DBD-ODBC-1.23/examples/testPrc.sql + DBD-ODBC-1.23/examples/testconnspeed.pl + DBD-ODBC-1.23/examples/testfunc.pl + DBD-ODBC-1.23/examples/testinout.pl + DBD-ODBC-1.23/examples/thrtest.pl + DBD-ODBC-1.23/examples/testdisc.pl + DBD-ODBC-1.23/examples/DbiTest2.pl + DBD-ODBC-1.23/examples/randombind.pl + DBD-ODBC-1.23/examples/testproc2.pl + DBD-ODBC-1.23/Makefile.PL + DBD-ODBC-1.23/FAQ + DBD-ODBC-1.23/README.RH9 + DBD-ODBC-1.23/README.informix + DBD-ODBC-1.23/MANIFEST + DBD-ODBC-1.23/README.hpux + DBD-ODBC-1.23/fixup_t.h + DBD-ODBC-1.23/fixup_c.h + DBD-ODBC-1.23/dbivport.h + DBD-ODBC-1.23/unicode_helper.h + DBD-ODBC-1.23/README.unicode + DBD-ODBC-1.23/ODBC.xs + DBD-ODBC-1.23/README.af + CPAN: File::Temp loaded ok (v0.18) + Warning (usually harmless): 'YAML' not installed, will not store persi +stent state + CPAN.pm: Going to build M/MJ/MJEVANS/DBD-ODBC-1.23.tar.gz Useless use of private variable in void context at Makefile.PL line 96 +3. Your LANG environment variable is set to "en_US.UTF-8" This is known to cause problems in some perl installations - even stop +ping this Makefile.PL from running without errors. If you have problems ple +ase try re-running with LANG unset or with the utf part of LANG removed. + You are using a Perl configured with threading enabled. Please read the warnings in DBI about this. You should also be aware that on non-Windows platforms ODBC drivers co +me in two forms, thread-safe and non-thread-safe drivers and you may need + to make sure you are using the right one. + Press return to continue... ********** Remember to actually *READ* the README file! And re-read it if you have any problems. ********** Looking for odbc_config on PATH odbc_config not found Looking for iodbc-config on PATH iodbc_config not found odbc_config not found - ok, there are other things I can do Still trying to guess ODBCHOME - looking for headers now trying /usr/include trying usr/local/include trying /usr/pkg/include trying /usr/local/easysoft/unixODBC/include 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 by: o setting the ODBCHOME environment variable o running 'perl Makefile.PL -o odbcdir' o adding path to odbc_config/iodbc_config to PATH If you do not have an ODBC Driver Manager you should try to get hold o +f the unixODBC packages for your system or build it from source (see + http://www.unixodbc.org). + No 'Makefile' createdWarning (usually harmless): 'YAML' not installed, + will not store persistent state + MJEVANS/DBD-ODBC-1.23.tar.gz + /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK + Running make test + Make had some problems, won't test + Running make install + Make had some problems, won't install + Could not read '/home/steve/.cpan/build/DBD-ODBC-1.23-6g3WIA/META.yml' +. Falling back to other methods to determine prerequisites + Failed during this command: + MJEVANS/DBD-ODBC-1.23.tar.gz : writemakefile NO -- No + 'Makefile' createdcpan[1]> install DBD::ODBC CPAN: Storable loaded ok (v2.18) Going to read '/home/steve/.cpan/Metadata' Database was generated on Sun, 18 Oct 2009 04:27:14 GMT Running install for module 'DBD::ODBC' CPAN: Data::Dumper loaded ok (v2.121_14) 'YAML' not installed, falling back to Data::Dumper and Storable to rea +d prefs '/home/steve/.cpan/prefs' + Running make for M/MJ/MJEVANS/DBD-ODBC-1.23.tar.gz + CPAN: Digest::SHA loaded ok (v5.45) + CPAN: Compress::Zlib loaded ok (v2.015) + Checksum for /home/steve/.cpan/sources/authors/id/M/MJ/MJEVANS/DBD-ODB +C-1.23.tar.gz ok + Scanning cache /home/steve/.cpan/build for sizes + ...................................................................... +......DONE CPAN: Archive::Tar loaded ok (v1.38) + Will not use Archive::Tar, need 1.00 + DBD-ODBC-1.23/ + DBD-ODBC-1.23/ConvertUTF.c + DBD-ODBC-1.23/ODBC.pm + DBD-ODBC-1.23/ODBC.h + DBD-ODBC-1.23/dbdimp.c + DBD-ODBC-1.23/README.windows + DBD-ODBC-1.23/README.sqlserver + DBD-ODBC-1.23/README.adabas + DBD-ODBC-1.23/META.yml + DBD-ODBC-1.23/dbdimp.h + DBD-ODBC-1.23/test_results.txt + DBD-ODBC-1.23/README + DBD-ODBC-1.23/unicode_helper.c + DBD-ODBC-1.23/Changes + DBD-ODBC-1.23/t/ + DBD-ODBC-1.23/t/09multi.t + DBD-ODBC-1.23/t/20SqlServer.t + DBD-ODBC-1.23/t/40UnicodeRoundTrip.t + DBD-ODBC-1.23/t/05meth.t + DBD-ODBC-1.23/t/01base.t + DBD-ODBC-1.23/t/rt_38977.t + DBD-ODBC-1.23/t/pod.t + DBD-ODBC-1.23/t/12blob.t + DBD-ODBC-1.23/t/rt_39897.t + DBD-ODBC-1.23/t/30Oracle.t + DBD-ODBC-1.23/t/07bind.t + DBD-ODBC-1.23/t/02simple.t + DBD-ODBC-1.23/t/pod-coverage.t + DBD-ODBC-1.23/t/rt_46597.t + DBD-ODBC-1.23/t/rt_43384.t + DBD-ODBC-1.23/t/UChelp.pm + DBD-ODBC-1.23/t/08bind2.t + DBD-ODBC-1.23/t/rt_null_nvarchar.t + DBD-ODBC-1.23/t/10handler.t + DBD-ODBC-1.23/t/ODBCTEST.pm + DBD-ODBC-1.23/t/rt_39841.t + DBD-ODBC-1.23/t/41Unicode.t + DBD-ODBC-1.23/t/03dbatt.t + DBD-ODBC-1.23/ConvertUTF.h + DBD-ODBC-1.23/README.osx + DBD-ODBC-1.23/examples/ + DBD-ODBC-1.23/examples/moreresults.pl + DBD-ODBC-1.23/examples/testspmulti.pl + DBD-ODBC-1.23/examples/joetest.pl + DBD-ODBC-1.23/examples/joetest5.pl + DBD-ODBC-1.23/examples/testproc.pl + DBD-ODBC-1.23/examples/leakcheck.pl + DBD-ODBC-1.23/examples/inttest.pl + DBD-ODBC-1.23/examples/sqltmptabs.pl + DBD-ODBC-1.23/examples/joetest6.pl + DBD-ODBC-1.23/examples/testproc3.pl + DBD-ODBC-1.23/examples/longbin.pl + DBD-ODBC-1.23/examples/proctest2.pl + DBD-ODBC-1.23/examples/testclob.pl + DBD-ODBC-1.23/examples/testmulti.pl + DBD-ODBC-1.23/examples/testkeys.pl + DBD-ODBC-1.23/examples/listtabs.pl + DBD-ODBC-1.23/examples/testundef2.pl + DBD-ODBC-1.23/examples/testconn.pl + DBD-ODBC-1.23/examples/Test_Dates_Jun19.pl + DBD-ODBC-1.23/examples/testdestruction.pl + DBD-ODBC-1.23/examples/proctest3.pl + DBD-ODBC-1.23/examples/timetest.pl + DBD-ODBC-1.23/examples/testerrhandler.pl + DBD-ODBC-1.23/examples/testundef.pl + DBD-ODBC-1.23/examples/testmoney.pl + DBD-ODBC-1.23/examples/money_test.cgi + DBD-ODBC-1.23/examples/testver.pl + DBD-ODBC-1.23/examples/identity.pl + DBD-ODBC-1.23/examples/northwind.pl + DBD-ODBC-1.23/examples/testcrtable.pl + DBD-ODBC-1.23/examples/proctest1.pl + DBD-ODBC-1.23/examples/coltest.pl + DBD-ODBC-1.23/examples/testxml.pl + DBD-ODBC-1.23/examples/joetest4.pl + DBD-ODBC-1.23/examples/joetest2.pl + DBD-ODBC-1.23/examples/testdatasources.pl + DBD-ODBC-1.23/examples/DbiTest.pl + DBD-ODBC-1.23/examples/testproc4.pl + DBD-ODBC-1.23/examples/cancel.pl + DBD-ODBC-1.23/examples/testundef3.pl + DBD-ODBC-1.23/examples/contest.pl + DBD-ODBC-1.23/examples/testgetinfo.pl + DBD-ODBC-1.23/examples/joetest7.pl + DBD-ODBC-1.23/examples/testigparams.pl + DBD-ODBC-1.23/examples/testPrc.sql + DBD-ODBC-1.23/examples/testconnspeed.pl + DBD-ODBC-1.23/examples/testfunc.pl + DBD-ODBC-1.23/examples/testinout.pl + DBD-ODBC-1.23/examples/thrtest.pl + DBD-ODBC-1.23/examples/testdisc.pl + DBD-ODBC-1.23/examples/DbiTest2.pl + DBD-ODBC-1.23/examples/randombind.pl + DBD-ODBC-1.23/examples/testproc2.pl + DBD-ODBC-1.23/Makefile.PL + DBD-ODBC-1.23/FAQ + DBD-ODBC-1.23/README.RH9 + DBD-ODBC-1.23/README.informix + DBD-ODBC-1.23/MANIFEST + DBD-ODBC-1.23/README.hpux + DBD-ODBC-1.23/fixup_t.h + DBD-ODBC-1.23/fixup_c.h + DBD-ODBC-1.23/dbivport.h + DBD-ODBC-1.23/unicode_helper.h + DBD-ODBC-1.23/README.unicode + DBD-ODBC-1.23/ODBC.xs + DBD-ODBC-1.23/README.af + CPAN: File::Temp loaded ok (v0.18) + Warning (usually harmless): 'YAML' not installed, will not store persi +stent state + CPAN.pm: Going to build M/MJ/MJEVANS/DBD-ODBC-1.23.tar.gz Useless use of private variable in void context at Makefile.PL line 96 +3. Your LANG environment variable is set to "en_US.UTF-8" This is known to cause problems in some perl installations - even stop +ping this Makefile.PL from running without errors. If you have problems ple +ase try re-running with LANG unset or with the utf part of LANG removed. + You are using a Perl configured with threading enabled. Please read the warnings in DBI about this. You should also be aware that on non-Windows platforms ODBC drivers co +me in two forms, thread-safe and non-thread-safe drivers and you may need + to make sure you are using the right one. + Press return to continue... ********** Remember to actually *READ* the README file! And re-read it if you have any problems. ********** Looking for odbc_config on PATH odbc_config not found Looking for iodbc-config on PATH iodbc_config not found odbc_config not found - ok, there are other things I can do Still trying to guess ODBCHOME - looking for headers now trying /usr/include trying usr/local/include trying /usr/pkg/include trying /usr/local/easysoft/unixODBC/include 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 by: o setting the ODBCHOME environment variable o running 'perl Makefile.PL -o odbcdir' o adding path to odbc_config/iodbc_config to PATH If you do not have an ODBC Driver Manager you should try to get hold o +f the unixODBC packages for your system or build it from source (see + http://www.unixodbc.org). + No 'Makefile' createdWarning (usually harmless): 'YAML' not installed, + will not store persistent state + MJEVANS/DBD-ODBC-1.23.tar.gz + /usr/bin/perl Makefile.PL INSTALLDIRS=site -- NOT OK Running make test + Make had some problems, won't test + Running make install + Make had some problems, won't install + Could not read '/home/steve/.cpan/build/DBD-ODBC-1.23-6g3WIA/META.yml' +. Falling back to other methods to determine prerequisites + Failed during this command: + MJEVANS/DBD-ODBC-1.23.tar.gz : writemakefile NO -- No + 'Makefile' created

Any help would be gratefully received.

Regards

Steve

Replies are listed 'Best First'.
Re: Installing DBD::ODBC
by Corion (Patriarch) on Oct 18, 2009 at 15:56 UTC

    I guess the relevant section of your output is:

    ********** Remember to actually *READ* the README file! And re-read it if you have any problems. ********** Looking for odbc_config on PATH odbc_config not found Looking for iodbc-config on PATH iodbc_config not found odbc_config not found - ok, there are other things I can do Still trying to guess ODBCHOME - looking for headers now trying /usr/include trying usr/local/include trying /usr/pkg/include trying /usr/local/easysoft/unixODBC/include 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 by: o setting the ODBCHOME environment variable o running 'perl Makefile.PL -o odbcdir' o adding path to odbc_config/iodbc_config to PATH

    So, which one of the three have you done? It seems that your odbc_config program was not installed in one of the common locations, so maybe you want to make sure that the installation of it actually succeeded?

      Hi Corion,

      Thanks for your input. It seems to be looking for odbc_config or iodbc_config, neither of which seem to exist anywhere on the machine (after doing a search), I've also searched google and the unixODBC website for clues about where it put ODBCHOME, but I can't find any clues. The unixODBC installation was perfect (from sudo apt-get install unixodbc).

      So I feel a bit lost. Maybe I should try pipes rather than ODBC, what do you use?

      Regards

      Steve

        How do you know that the unixODBC installation went well when one of the programs that are supposed to get installed with unixODBC is missing? If you are really sure you know where unixODBC got installed to, maybe just set $ENV{ODBCHOME} to it.

        Personally, I use DBD::ODBC on Windows, where it works as advertised, because Windows comes with the ODBC manager.

Re: Installing DBD::ODBC
by jakobi (Pilgrim) on Oct 18, 2009 at 16:11 UTC
      Thanks for your readmore suggestion, now done.
      Steve
Re: Installing DBD::ODBC
by gmargo (Hermit) on Oct 18, 2009 at 16:18 UTC

    Is there any particular reason that you must use the latest-and-greatest version from CPAN?
    Have you tried the Ubuntu-provided "libdbd-odbc-perl" package?

    Regarding "iodbc-config", that is present in the "libiodbc2-dev" package.

    In general, if you're looking for available packages for your Ubuntu system, you can use "apt-cache search" on the command line or use the Ubuntu Packages page. It is likely that everything you need can be installed without going to CPAN.

      None at all, just want to connect.

      Regards

Re: Installing DBD::ODBC
by mje (Curate) on Oct 19, 2009 at 08:17 UTC

    In most cases you need an ODBC driver manager installed before installing DBD::ODBC (a very few ODBC drivers work with it directly but that is no longer recommended).

    DBD::ODBC is mostly C code and XS and you need the driver manager C header files in addition to the driver manager itself. That probably means (in these days of packages) you need unixodbc main package and unixodbc-dev package.

    Looking for odbc_config on PATH odbc_config not found Looking for iodbc-config on PATH iodbc_config not found odbc_config not found - ok, there are other things I can do

    More modern versions of unixODBC and iODBC contain a config program ((x)odbc_config) which makes DBD::ODBC's life of configuring and itself to match the many different ways driver managers can be built a lot easier. As a result, DBD::ODBC looks for Xodbc_config first. In you case your installed odbc driver manager is too old for that so it is falling back on trying to locate driver manager header files:

    Still trying to guess ODBCHOME - looking for headers now trying /usr/include trying usr/local/include trying /usr/pkg/include trying /usr/local/easysoft/unixODBC/include

    It looks to me like you have not installed unixodbc-dev package that contains the headers or you installed in a non-standard place and did not use ODBCHOME or -o to point to them.

Re: Installing DBD::ODBC
by Steve_BZ (Chaplain) on Oct 19, 2009 at 20:29 UTC

    Hi Monks

    Just to update, well managed to get DBD::ODBC installed by using KPackage on Kubuntu. Now trying to sort out drivers. Thanks for all your help and suggestions.

    Regards

    Steve

Re: Installing DBD::ODBC
by afoken (Chancellor) on Oct 20, 2009 at 12:13 UTC

    Is there any reason why you want to use ODBC on a non-Windows system? ODBC adds a lot of overhead and prevents using shortcuts. For most free and many commercial RBDMS', you can get native DBI drivers (in the DBD:: namespace) that are faster and support special features of the individual databases. Unless you have very special requirements (such as a 3rd party application requiring an ODBC manager), it is very likely that you need neither DBD::ODBC nor an ODBC manager. Install the required client libraries provided by the RBDMS and the native DBD (DBD::Pg, DBD::mysql, DBD::Oracle, DBD::DB2, ...) and you're done. If you want to connect to a MS SQL Server on a Windows server, read the DBD::ODBC::FAQ. From there, you will learn that you either need to spend money or use DBD::ProxyServer, DBD::Gofer, or DBD::Sybase.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Fantastic:

      So I can use DBD::Interbase!

      Steve

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://801871]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-25 11:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found