Skip to Content.
Sympa Menu

freetds - Re: [freetds] bugreport: tsql connect fails when log file is unwriteable

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddy77 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] bugreport: tsql connect fails when log file is unwriteable
  • Date: Wed, 3 Mar 2010 14:19:19 +0100

2010/3/3 Petr Klíma <qaxi AT seznam.cz>:
>
> tsql fails connect when log file is unwriteable.
> No error message indicating "log file is unwriteable", but misterious
> "Unable to connect: Adaptive Server is unavailable or does not exist."
>
> It has two efects ...
>
> - you can not debug connections from php module on http server (runs
> under id=apache)
> - when you try souch debug, all your applications using freetds directly
> or indirectly (php_mssql, php_odbc ...) fails to connect to server
>
>
>
> Patch not provided, C knowledge not installed
>
>
>
> supporting informations:
> =====================================================
> # tsql -C
> Compile-time settings (established with the "configure" script)
>                             Version: freetds v0.82
>              freetds.conf directory: /etc
>      MS db-lib source compatibility: yes
>         Sybase binary compatibility: yes
>                       Thread safety: yes
>                       iconv library: yes
>                         TDS version: 4.2
>                               iODBC: no
>                            unixodbc: yes
>
> # cat /etc/freetds.conf
> [global]
>     initial block size = 512
>     text size = 64512
>
> [hrochSRV2]
>         # connect to MSSQL 2008 server instance
>         tds version = 8.0
>         client charset = UTF-8
>         dump file = /tmp/freetds.log
>         dump file append = yes
>         host = hroch.xxxxxxxx.xx
>         port = 49327
>         instance = SRV2
>
> # ---------------------------------------
> #  this is OK
> # ---------------------------------------
>
> # rm /tmp/freetds.log
> # touch /tmp/freetds.log
> # ll /tmp/freetds.log
> -rw-r--r-- 1 root root 0 bre  3 10:35 /tmp/freetds.log
> #
> #
> #
> # export LANG=C; tsql -S hrochSRV2 -U aaaa -P bbbbb
> locale is "C"
> locale charset is "ANSI_X3.4-1968"
> 1> use AGROTEST ;
> 2> go
> 1> select kodfmista as id from cis_adresyF;
> 2> go
> id
> 10
> 11
> .
> .
> .
> 764200
> (1353 rows affected)
> 1> exit
> #
>
> # ---------------------------------------
> #  this FAILS
> # ---------------------------------------
>
>
> # rm /tmp/freetds.log
> # touch /tmp/freetds.log
> # ll /tmp/freetds.log
> -rw-r--r-- 1 root root 0 Mar  3 10:41 /tmp/freetds.log
> #
> #
>
> # ---------------------------
> # log as unprivileged user
> # ---------------------------
> # su -l -s /bin/bash apache
> -bash-3.2$
> -bash-3.2$
> -bash-3.2$ export LANG=C; tsql -S hrochSRV2 -U aaaaaa -P bbbbbb
> locale is "C"
> locale charset is "ANSI_X3.4-1968"
> Msg 20009, Level 9, State -1, Server OpenClient, Line -1
> Unable to connect: Adaptive Server is unavailable or does not exist
> There was a problem connecting to the server
> -bash-3.2$
>
>
>       Petr Klíma
>    <qaxi AT seznam.cz>
>

Opps.... fixed in CVS, post 0.82 patch at http://freetds.sourceforge.net/
Problem was already fixed in CVS HEAD but not backported in 0.82. The
problem was that error from socket was override by other calls which
lead to wrong error detection. Now socket error is saved just after
socket call to avoid this behavior.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page