http://qs321.pair.com?node_id=1200149

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

Help!!! We installed the new mssql driver (https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools#a-idrhelainstall-tools-on-rhel-7) on RHEL 7 .. Can connect via sqlcmd without issues, but cannot connect via perl

odbcinst -j unixODBC 2.3.1 DRIVERS............: /etma/bin/conf/odbcinst.ini SYSTEM DATA SOURCES: /etma/bin/conf/odbc.ini FILE DATA SOURCES..: /etma/bin/conf/ODBCDataSources USER DATA SOURCES..: /home/etmadev/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8

Using DBI ver 1.616 and DBD::ODBC 1.31getting this: '[unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.9.0' : file not found (SQL-01000)'

However, that driver is successfully installed.... Any pointers please?........ Thank you... We had no issues on RHEL5...+

2017-09-27 Athanasius added code and paragraph tags

Replies are listed 'Best First'.
Re: connecting to mssql on rhel7 with new mssql driver
by NetWallah (Canon) on Sep 27, 2017 at 02:58 UTC
    Welcome to the Monastary!

    Please review Writeup Formatting Tips for information on how to format your post properly.

    Your post shows conflicting versions of ODBC:
    unixODBC 2.3.1 vs
    DBD::ODBC 1.31

    You seem to be using ODBC version 1.31 which is from 2011.
    The current version of DBD::ODBC on cpan is 1.56.

    There is a comment on the fixes for ODBC version 1.34 that may be relevant to your issue:

    1.34_3 2012-02-03
     
      [BUG FIXES]
     
      * Linking against unixODBC was working by accident on most UNIX
        machines and depended on the order of the files in /usr/lib (or
        wherever) and what files there were (e.g. an archive or a shared
        object). Same applied to iODBC but it was more broken especially
        on machines where libiodbc.so.N.N existed but there was no
        libiodbc.so which could lead to no adding the shared object at
        all. I doubt anyone really noticed this but I did eventually on
        Ubuntu where libiodbc.so.N.N existed but libiodbc.so did not.
    
    Try installing a more current version of DBD::ODBC.

                    All power corrupts, but we need electricity.

      Thank you for your reply! I downloaded 1.56, but running into some issues making the file..

      make complains: /bin/sh: gcc: command not found


      /efs/dist/perl5/core/5.10/exec/bin/perl Makefile.PL
      ********** Remember to actually *READ* the README file! And re-read it if you have any problems. ********** OSNAME: linux LANG: en_US.UTF-8 ODBCHOME: LD_LIBRARY_PATH: /efs/dist/sybase/openclient/15.7-ESD4-build001/exec/D +ataAccess64/ODBC/lib:/efs/dist/sybase/openclient/15.7-ESD4-build001/e +xec/DataAccess/ODBC/lib:/efs/dist/sybase/openclient/15.7-ESD4-build00 +1/exec/OCS-15_0/lib:/efs/dist/sybase/openclient/15.7-ESD4-build001/ex +ec/OCS-15_0/lib3p64:/efs/dist/sybase/openclient/15.7-ESD4-build001/ex +ec/OCS-15_0/lib3p::/efs/dist/oracledb/client/11.2.0.3/exec/lib:/efs/d +ist/fsf/gcc/4.1.1/exec/lib;/usr/lib64 DBROOT: WINDIR: II_SYSTEM: Perl: 5.010000 ExtUtils::MakeMaker: 6.42 Command line options: u! = undef w! = undef e! = undef g! = 0 x! = undef o=s = 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... Looking for odbc_config in : nowhere Looking for odbc_config in (PATH) /efs/dist/sybase/openclient/15.7-ESD +4-build001/exec/OCS-15_0/bin:/efs/dist/efs/core/prod/common/bin:/usr/ +local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/etc:/efs/dist/oracledb/c +lient/10G/exec/bin:/etma/ixp/bin:/efs/dist/oracle/jdk/1.8.0u92/exec/b +in Found odbc_config (via odbc_config) version 2.3.1 odbc_config reports --prefix=/usr odbc_config reports --include-prefix=/usr/include odbc_config reports --lib-prefix=/usr/lib64 ODBC INC dir set to /usr/include via odbc_config ODBC LIB dir set to /usr/lib64 via odbc_config Using ODBCHOME /usr This looks like a unixodbc type of driver manager. Looking for odbcinst Found odbcinst in /usr/bin odbcinst -j reports: unixODBC 2.3.1 DRIVERS............: /etma/bin/conf/odbcinst.ini SYSTEM DATA SOURCES: /etma/bin/conf/odbc.ini FILE DATA SOURCES..: /etma/bin/conf/ODBCDataSources USER DATA SOURCES..: /home/etmadev/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8 Please note these files as they are where you define your ODBC drivers + and data sources. Looking for odbc_config to get cflags Adding odbc_config --cflags "-DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_T +YPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I/usr/include " to CC li +ne Using DBI 1.616 (for perl 5.010000 on x86_64-linux-thread-multi) insta +lled in /efs/dist/perl5/DBI/1.616/.exec/x86-64.rhel.7/5.10/lib/perl5/ +auto/DBI/ Using DBI 1.616 (for perl 5.010000 on x86_64-linux-thread-multi) insta +lled in /efs/dist/perl5/DBI/1.616/.exec/x86-64.rhel.7/5.10/lib/perl5/ +auto/DBI/ Writing Makefile for DBD::ODBC Warning: not all required environment variables are set. Warning: Will not be able to run tests as you have not defined all of DBI_DSN, DBI_USER and DBI_PASS environment variables.

      etmadev@DEV08:36:29>make
      gcc -c -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LON +G -DSIZEOF_LONG_INT=8 -I/usr/include -I/usr/include -I. -I/efs/dist +/perl5/DBI/1.616/.exec/x86-64.rhel.7/5.10/lib/perl5/auto/DBI -D_REENT +RANT -D_GNU_SOURCE -DAPPLLIB_EXP="/efs/dist/perl5/defaults/5.10/.exec +/x86-64.linux.2.6/5.10/lib/perl5:/efs/dist/perl5/defaults/5.10/.exec/ +x86-64.linux.2.6/lib/perl5:/efs/dist/perl5/defaults/5.10/common/lib/p +erl5" -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_B +ITS=64 -O -DVERSION=\"1.56\" -DXS_VERSION=\"1.56\" -fPIC "-I/efs/di +st/perl5/core/5.10.0-ml01/.exec/x86-64.linux.2.6/lib/perl5/CORE" -DH +AVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEO +F_LONG_INT=8 -I/usr/include -I/usr/include ConvertUTF.c /bin/sh: gcc: command not found make: *** [ConvertUTF.o] Error 127
        make complains: /bin/sh: gcc: command not found

        There are two possibile reasons for this. Firstly, gcc may not be installed, in which case the solution is to install it. Secondly, gcc may be installed but not in your PATH, in which case the solution is to modify your PATH to include it.

        "/bin/sh: gcc: command not found"

        Have you checked you have a working gcc installed and a sane build environment?

        /bin/sh: gcc: command not found

        As marto++ and hippo++ have told you, your system lacks a C compiler. Unfortunately, this has become quite usual for binary Linux distributions. And most likely, your system not only lacks a C compiler, but perhaps also a lot of headers, libraries and so on. So, making your package manager install gcc is most likely not sufficient. Look up the documentation and FAQs for your distribution for something like "how to I compile a C program". Often, you will read that you should install some kind of "development meta package" that installs gcc and the other missing stuff.

        Also note that DBD::mysql is said to be in a sad state ("DBD::mysql is dead right now"):

        Alexander

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