Find the answer to your Linux question:
Results 1 to 4 of 4
Hello, I successfully (I think) installed and configured FreeTDS using instructions found at a few websites including FreeTDS's, unixODBC's (I can't seem to put links due to my account's restrictions). ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    3

    FreeTDS odbc ms sql server problem

    Hello,

    I successfully (I think) installed and configured FreeTDS using instructions found at a few websites including FreeTDS's, unixODBC's (I can't seem to put links due to my account's restrictions).

    I have CentOS 4.7, and downloaded/installed freetds 0.82. I'm trying to connect to a MS SQL Sever 2000 machine (running Windows 2000 Server) via ODBC. I can connect to it using tsql, but it fails when trying to use isql, it fails.
    My isql command line:
    Code:
    isql -v MSSQLServer myuser mypass
    I get:
    Code:
    [IM004][unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed
    [ISQL]ERROR: Could not SQLConnect
    Let me know and I can provide other info...I am fairly inexperienced in Linux however.

  2. #2
    Just Joined!
    Join Date
    Jun 2009
    Posts
    3
    Well, I've gotten a little more information.
    It seems that I'm missing a couple files in my /usr/lib directory - I don't have libtdsodbc.so.0 and libtdsodbc.so.0.0.0. I found this out by searching the net further, and installing freeTDS on my extra machine that has CentOS 5.3 on it. I was able to install freeTDS via yum on this way, so that is different. This CentOS 5.3 has these files on it, and when I configured an ODBC driver, and dsn, I can connect to my MS SQL Server successfully.
    So I'm not sure what to do next to get my other machine to work though. I tried to connect again this morning, and of course it failed, but here's the sql.log contents:

    Code:
    [ODBC][31475][SQLFreeHandle.c][268]
                    Entry:
                            Handle Type = 2
                            Input Handle = 0x8ea2130
    [ODBC][31475][SQLFreeHandle.c][317]
                    Exit:[SQL_SUCCESS]
    [ODBC][31475][SQLFreeHandle.c][203]
                    Entry:
                            Handle Type = 1
                            Input Handle = 0x8ea1b58
    [ODBC][31483][__handles.c][444]
                    Exit:[SQL_SUCCESS]
                            Environment = 0x9290b58
    [ODBC][31483][SQLAllocHandle.c][345]
                    Entry:
                            Handle Type = 2
                            Input Handle = 0x9290b58
    [ODBC][31483][SQLAllocHandle.c][463]
                    Exit:[SQL_SUCCESS]
                            Output Handle = 0x9291130
    [ODBC][31483][SQLConnect.c][3549]
                    Entry:
                            Connection = 0x9291130
                            Server Name = [MSSQLServer][length = 11 (SQL_NTS)]
                            User Name = [jamie][length = 5 (SQL_NTS)]
                            Authentication = [******][length = 6 (SQL_NTS)]
                    UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'
    
    [ODBC][31483][SQLConnect.c][1249]Error: IM004
    [ODBC][31483][SQLError.c][424]
                    Entry:
                            Connection = 0x9291130
                            SQLState = 0xbfff1770
                            Native = 0xbfff1768
                            Message Text = 0xbfff1780
                            Buffer Length = 500
                            Text Len Ptr = 0xbfff176e
    [ODBC][31483][SQLError.c][461]
                    Exit:[SQL_SUCCESS]
                            SQLState = IM004
                            Native = 0xbfff1768 -> 0
                            Message Text = [[unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_HENV failed]
    [ODBC][31483][SQLError.c][424]
                    Entry:
                            Connection = 0x9291130
                            SQLState = 0xbfff1770
                            Native = 0xbfff1768
                            Message Text = 0xbfff1780
                            Buffer Length = 500
                            Text Len Ptr = 0xbfff176e
    [ODBC][31483][SQLError.c][461]
                    Exit:[SQL_NO_DATA]
    [ODBC][31483][SQLError.c][504]
                    Entry:
                            Environment = 0x9290b58
                            SQLState = 0xbfff1770
                            Native = 0xbfff1768
                            Message Text = 0xbfff1780
                            Buffer Length = 500
                            Text Len Ptr = 0xbfff176e
    [ODBC][31483][SQLError.c][541]
                    Exit:[SQL_NO_DATA]
    [ODBC][31483][SQLFreeHandle.c][268]
                    Entry:
                            Handle Type = 2
                            Input Handle = 0x9291130
    [ODBC][31483][SQLFreeHandle.c][317]
                    Exit:[SQL_SUCCESS]
    [ODBC][31483][SQLFreeHandle.c][203]
                    Entry:
                            Handle Type = 1
                            Input Handle = 0x9290b58
    Thanks.

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    3
    Here's another update.

    I copied over the 2 missing files (libtdsodbc) from the newer CentOS 5.3 machine to the one that I cannot get to work. Then when I ran isql to try to connect to the MS SQL Server, I get the following error:

    Code:
    [01000][unixODBC][Driver Manager]Can't open lib '/usr/lib/libtdsodbc.so.0' : /usr/lib/libtdsodbc.so.0: requires glibc 2.5 or later dynamic linker
    [ISQL]ERROR: Could not SQLConnect
    Seeing that, I then ran:
    Code:
    rpm -qa | grep glibc
    and the output was:

    Code:
    glibc-headers-2.3.4-2.41
    glibc-2.3.4-2.41
    glibc-kernheaders-2.4-9.1.103.EL
    glibc-devel-2.3.4-2.41
    glibc-common-2.3.4-2.41
    So then I ran 'yum update glibc' to see if I could update these files, and got the following:

    Code:
    =============================================================================
     Package                 Arch       Version          Repository        Size
    =============================================================================
    Updating:
     glibc                   i386       2.3.4-2.41.el4_7.1  update            4.3 M
    Updating for dependencies:
     glibc-common            i386       2.3.4-2.41.el4_7.1  update             16 M
     glibc-devel             i386       2.3.4-2.41.el4_7.1  update            1.9 M
     glibc-headers           i386       2.3.4-2.41.el4_7.1  update            588 k
    
    Transaction Summary
    =============================================================================
    Then I ran 'rpm -qa | grep glibc' on the newer system (just to verify that it had the newer glibc >= 2.5), and got the following:
    Code:
    glibc-2.5-34
    glibc-headers-2.5-34
    glibc-devel-2.5-34
    glibc-common-2.5-34
    So it seems that I'm pretty much 'out of luck' on this old system...is that true?

  4. #4
    Just Joined!
    Join Date
    Jul 2009
    Location
    Seattle
    Posts
    1

    Linux ODBC and MS SQL

    domiflichi,

    Hey man, I feel the pain. My advise is to start from the beginning. I struggled for a few days on this one myself. However in the end everything worked out. One thing that got me early on was incorrect permissions to access the MS SQL database.

    I'm using Fedora 10, which is similar to Cent OS, here are my configs:



    /etc/odbc.ini

    [PostgreSQL]
    Description = ODBC for PostgreSQL
    Driver = /usr/lib/libodbcpsql.so
    Setup = /usr/lib/libodbcpsqlS.so
    FileUsage = 1

    [ms-sql]
    Description = TDS connection
    Driver = /usr/lib/libtdsodbc.so
    Setup = /usr/lib/libtdsS.so
    UsageCount = 1
    FileUsage = 1



    and



    /etc/odbcinst.ini :

    [PostgreSQL]
    Description = ODBC for PostgreSQL
    Driver = /usr/lib/libodbcpsql.so
    Setup = /usr/lib/libodbcpsqlS.so
    FileUsage = 1

    [ms-sql]
    Description = TDS connection
    Driver = /usr/lib/libtdsodbc.so
    Setup = /usr/lib/libtdsS.so
    UsageCount = 1
    FileUsage = 1



    Also I wrote a article on my blog about ODBC a month ago:

    Do a keyword search for savelono, you will find me!

    Good Luck!

    one other thing,

    try using the locate command to verify that the libraries exist in the location expected!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...