Re: Problems Connecting Debian --> MSSQL through odbc

Jaap van Arragon <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <C6960DFE.237E5%[email protected]>
SERVER:~# TDSDUMPCONFIG=stderr TDSDUMP=stderr ./osqlscript.sh -S SBGROEP -U
admin -P pass 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
[SBGROEP] found in /root/.odbc.ini
found this section:
    [SBGROEP]
    Driver          = FreeTDS
    #Driver          = /usr/lib/odbc/libtdsodbc.so
    Description             = A good description of your DB
    Trace           = Yes
    Server          = URL
    Port            = 1433
    Database    = db2
    TDS_Version     = 7.0
    
looking for driver for DSN [SBGROEP] in /root/.odbc.ini
  found driver line: "    Driver          = FreeTDS"
  driver "FreeTDS" found for [SBGROEP] 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 URL www.url.nl"

Configuration looks OK.  Connection details:

                   DSN:    SBGROEP
              odbc.ini:    /root/.odbc.ini
                Driver:    /usr/lib/odbc/libtdsodbc.so
       Server hostname:    URL
               Address:    IP ADDRESS

Attempting connection as admin ...
+ isql SBGROEP admin pass -v
log.c:190:Starting log file for FreeTDS 0.82
    on 2009-07-29 14:23:11 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 IP ADDRESS port 1433 (TDS version 7.0)
net.c:264:tds_open_socket: connect(2) returned "Operation now in progress"
net.c:303:tds_open_socket() succeeded
util.c:162:Changed query state from DEAD to IDLE
login.c:735:quietly sending TDS 7+ login packet
token.c:312:tds_process_login_tokens()
net.c:592:Received header
0000 04 01 00 6c 00 5b 01 00-                        |...l.[..|

net.c:671:Received packet
0000 aa 58 00 18 48 00 00 01-0e 1f 00 4c 00 6f 00 67 |.X..H... ...L.o.g|
0010 00 69 00 6e 00 20 00 66-00 61 00 69 00 6c 00 65 |.i.n. .f .a.i.l.e|
0020 00 64 00 20 00 66 00 6f-00 72 00 20 00 75 00 73 |.d. .f.o .r. .u.s|
0030 00 65 00 72 00 20 00 27-00 73 00 71 00 6c 00 77 |.e.r. .' .a.s.m.i|
0040 00 65 00 62 00 27 00 2e-00 07 53 00 42 00 47 00 |.n..'.. ..S.B.G.|
0050 53 00 51 00 4c 00 31 00-00 01 00 fd 02 00 00 00 |p.a.s.s. ........|
0060 00 00 00 00            -                        |....|

token.c:316:looking for login token, got  aa(ERROR)
token.c:108:tds_process_default_tokens() marker is aa(ERROR)
token.c:2451:tds_process_msg() reading message from server
token.c:2516:tds_process_msg() calling client msg handler
odbc.c:2032:msgno 18456 20003
token.c:2529:tds_process_msg() returning TDS_SUCCEED
token.c:316:looking for login token, got  fd(DONE)
token.c:108:tds_process_default_tokens() marker is fd(DONE)
token.c:2201:tds_process_end: more_results = 0
        was_cancelled = 0
        error = 1
        done_count_valid = 0
token.c:2217:tds_process_end() state set to TDS_IDLE
token.c:2232:                rows_affected = 0
token.c:393:leaving tds_process_login_tokens() returning 0
util.c:162:Changed query state from IDLE to DEAD
util.c:334:tdserror(0x8067220, 0x8065c38, 20002, 0)
odbc.c:2032:msgno 20002 20003
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)
mem.c:563:tds_free_all_results()
error.c:574:SQLError((nil), 0x80651e0, (nil), 0xbfd8198e, 0xbfd81994,
0xbfd814b4, 513, 0xbfd8199e)
error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbfd8198e, 0xbfd81994,
0xbfd814b4, 513, 0xbfd8199e)
error.c:574:SQLError((nil), 0x80651e0, (nil), 0xbfd8198e, 0xbfd81994,
0xbfd814b4, 513, 0xbfd8199e)
error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbfd8198e, 0xbfd81994,
0xbfd814b4, 513, 0xbfd8199e)
error.c:574:SQLError((nil), 0x80651e0, (nil), 0xbfd8198e, 0xbfd81994,
0xbfd814b4, 513, 0xbfd8199e)
error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbfd8198e, 0xbfd81994,
0xbfd814b4, 513, 0xbfd8199e)
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
[37000][unixODBC][FreeTDS][SQL Server]Login failed for user 'admin'.
[ISQL]ERROR: Could not SQLConnect
sed: can't read stderr: No such file or directory

Any idea why I cant connect?


On 7/29/09 8:12 AM, "Jaap van Arragon" <[email protected]> wrote:

> 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, "[email protected]" <[email protected]>
> 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
>> [email protected]
>> http://lists.ibiblio.org/mailman/listinfo/freetds
> 
> 
> _______________________________________________
> FreeTDS mailing list
> [email protected]
> http://lists.ibiblio.org/mailman/listinfo/freetds
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.