[freetds] Problems Connecting Debian --> MSSQL through odbc

Jaap van Arragon j.vanarragon at lukkien.com
Wed Jul 29 02:12:24 EDT 2009


I have the output.
The strange thing is that it worked for 2 weeks ago. I only changed the
login details and host and it ain't working anymore.


SERVER:~# ls -l /usr/lib/odbc/libtdsodbc.so*
-rw-r--r-- 1 root root 335520 2008-08-02 21:38 /usr/lib/odbc/libtdsodbc.so

SERVER:~# ls -l /usr/lib64/libsybdb.so* | awk '{print $1,$9}'
ls: /usr/lib64/libsybdb.so*: No such file or directory

SERVER:~# for F in  /usr/lib64/libsybdb.so*; do if [ -x $F ]; then echo
executable: $F; fi; done

SERVER:~# TDSDUMPCONFIG=stderr TDSDUMP=stderr ./osqlscript.sh -S DSNNAME -U
admin -P pass checking shared odbc libraries linked to isql for default
directories...
strings: '': No such file
    trying /tmp ... no
    trying /sql ... no
    trying /tmp ... no
    trying /sql ... no
    trying /tmp/sql.log ... no
    trying /home ... no
    trying /.odbc.ini ... no
    trying /etc ... OK
checking odbc.ini files
    reading /root/.odbc.ini
[DSNNAME] found in /root/.odbc.ini
found this section:
    [DSNNAME]
    Driver          = FreeTDS
    #Driver          = /usr/lib/odbc/libtdsodbc.so
    Description             = A good description of your DB
    Trace           = Yes
    Server          = SERVER
    Port            = 1433
    Database    = DATABASE
    TDS_Version     = 7.0
    
looking for driver for DSN [DSNNAME] in /root/.odbc.ini
  found driver line: "    Driver          = FreeTDS"
  driver "FreeTDS" found for [DSNNAME] in .odbc.ini
found driver named "FreeTDS"
"FreeTDS" is not an executable file
looking for entry named [FreeTDS] in /etc/odbcinst.ini
  found driver line: "    Driver        = /usr/lib/odbc/libtdsodbc.so"
  found driver /usr/lib/odbc/libtdsodbc.so for [FreeTDS] in odbcinst.ini
/usr/lib/odbc/libtdsodbc.so is an executable file
"Server" found, not using freetds.conf
Server is "SERVER"

Configuration looks OK.  Connection details:

                   DSN:    DSNNAME
              odbc.ini:    /root/.odbc.ini
                Driver:    /usr/lib/odbc/libtdsodbc.so
       Server hostname:    SERVER
               Address:    IP

Attempting connection as admin ...
+ isql DSNNAME admin pass -v
log.c:190:Starting log file for FreeTDS 0.82
    on 2009-07-29 07:53:00 with debug flags 0x4fff.
iconv.c:197:names for ISO-8859-1: ISO-8859-1
iconv.c:197:names for UTF-8: UTF-8
iconv.c:197:names for UCS-2LE: UCS-2LE
iconv.c:197:names for UCS-2BE: UCS-2BE
iconv.c:363:iconv to convert client-side data to the "UTF-8" character set
iconv.c:516:tds_iconv_info_init: converting "UTF-8"->"UCS-2LE"
iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
net.c:210:Connecting to IPADDRESS port 1433 (TDS version 7.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:299:getsockopt(2) reported: Connection timed out
util.c:334:tdserror(0x8067220, 0x8065c38, 20009, 115)
odbc.c:2032:msgno 20009 20003
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
net.c:310:tds_open_socket() failed
mem.c:563:tds_free_all_results()
error.c:574:SQLError((nil), 0x80651e0, (nil), 0xbf8b74ce, 0xbf8b74d4,
0xbf8b6ff4, 513, 0xbf8b74de)
error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbf8b74ce, 0xbf8b74d4,
0xbf8b6ff4, 513, 0xbf8b74de)
error.c:574:SQLError((nil), 0x80651e0, (nil), 0xbf8b74ce, 0xbf8b74d4,
0xbf8b6ff4, 513, 0xbf8b74de)
error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbf8b74ce, 0xbf8b74d4,
0xbf8b6ff4, 513, 0xbf8b74de)
error.c:574:SQLError((nil), 0x80651e0, (nil), 0xbf8b74ce, 0xbf8b74d4,
0xbf8b6ff4, 513, 0xbf8b74de)
error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbf8b74ce, 0xbf8b74d4,
0xbf8b6ff4, 513, 0xbf8b74de)
odbc.c:3734:SQLFreeConnect(0x80651e0)
odbc.c:3706:_SQLFreeConnect(0x80651e0)
odbc.c:3757:SQLFreeEnv(0x80645e8)
odbc.c:3744:_SQLFreeEnv(0x80645e8)
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[08S01][unixODBC][FreeTDS][SQL Server]Unable to connect: Adaptive Server is
unavailable or does not exist
[ISQL]ERROR: Could not SQLConnect
sed: can't read stderr: No such file or directory

Very strange.


On 7/28/09 8:04 PM, "jklowden at schemamania.org" <jklowden at schemamania.org>
wrote:

> On Tue, Jul 28, 2009 at 05:13:54PM +0200, Jaap van Arragon wrote:
>> 
>> In the script it says that its finding the driver but at the end the driver
>> cannot be found?
> 
> Take away the sh -x output and perhaps it's clearer:
> 
>>   found driver line: "    Driver        = /usr/lib/odbc/libtdsodbc.so"
>>   found driver /usr/lib/odbc/libtdsodbc.so for [FreeTDS] in odbcinst.ini
>> /usr/lib/odbc/libtdsodbc.so is not an executable file
>> osqlscript.sh: error: no driver found for SBGROEP
> 
> 
> Maybe "found" isn't quite right; it means it found that string in the file,
> not the file in the filesystem.  That is,
> 
>>   found driver /usr/lib/odbc/libtdsodbc.so for [FreeTDS] in odbcinst.ini
> 
> means odbcinst.ini has a section [FreeTDS] with a Driver line, i.e.:
> 
> Driver        = /usr/lib/odbc/libtdsodbc.so
> 
> and osql successfully parsed the line for the right-hand argument.
> 
> Now, just because that line exists in odbcinst.ini, it doesn't mean there's a
> file by that name on the disk.  Or, if it does exist, that it's executable for
> the user running the process.  What does
> 
> ls -l /usr/lib/odbc/libtdsodbc.so*
> 
> report?  It should both exist and executable, e.g.:
> 
> $ ls -l /usr/lib64/libsybdb.so* | awk '{print $1,$9}'
> lrwxrwxrwx  /usr/lib64/libsybdb.so
> lrwxrwxrwx  /usr/lib64/libsybdb.so.5
> -rwxr-xr-x  /usr/lib64/libsybdb.so.5.0.0
> 
> $ for F in  /usr/lib64/libsybdb.so*; do if [ -x $F ]; then echo executable:
> $F; fi; done
> executable: /usr/lib64/libsybdb.so
> executable: /usr/lib64/libsybdb.so.5
> executable: /usr/lib64/libsybdb.so.5.0.0
> 
> HTH.
> 
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




More information about the FreeTDS mailing list