Re: Problems Connecting Debian --> MSSQL through odbc

Jaap van Arragon <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <C6850EBB.22C47%[email protected]>
OPTION 1:

SERVER:~# TDSDUMPCONFIG=stderr TDSDUMP=stderr
SERVER:~# isql -v TEST admin pass
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[ISQL]ERROR: Could not SQLConnect

OPTION 2: 

LUKKIEN-staging:~# sh -x ./osqlscript.sh -S TEST -U admin -P pass
++ basename ./osqlscript.sh
+ USAGE='Syntax: osqlscript.sh -S server -U user -P password'
+ getopts I:S:U:P: OPTION
+ case ${OPTION} in
+ DSN=TEST
+ getopts I:S:U:P: OPTION
+ case ${OPTION} in
+ USERNAME=admin
+ getopts I:S:U:P: OPTION
+ case ${OPTION} in
+ PASSWORD=pass
+ getopts I:S:U:P: OPTION
+ '[' -z TEST -o -z admin -o -z pass ']'
++ command -v isql
+ ISQL=/usr/bin/isql
+ '[' -z /usr/bin/isql ']'
++ strings /usr/bin/isql
++ grep '^/'
++ grep -v elf
++ grep -v '\.so\.'
++ head -1
++ sed 's/lib$/etc/'
+ ISQL_DIR=
++ basename ./osqlscript.sh
+ INI_DIRNAME=/tmp/osqlscript.sh.16930
+ exec
+ '[' -z '' ']'
+ echo 'checking shared odbc libraries linked to isql for default
directories...'
checking shared odbc libraries linked to isql for default directories...
+ echo
+ ldd /usr/bin/isql
+ awk '/[-]lodbc/ {print $3}'
+ read L
+ strings ''
strings: '': No such file
+ grep '^/'
+ grep -v /lib
+ read D
+ read L
++ cat /tmp/osqlscript.sh.16930
+ ODBC_DIR=
+ rm /tmp/osqlscript.sh.16930
+ '[' -z '' -a -z '' ']'
++ basename ./osqlscript.sh
++ command -v isql
+ echo 'osqlscript.sh: problem: no potential directory strings in
"/usr/bin/isql"'
osqlscript.sh: problem: no potential directory strings in "/usr/bin/isql"
++ basename ./osqlscript.sh
+ echo 'osqlscript.sh: advice: use "osql -I DIR" where DIR unixODBC\'\''s
install prefix e.g. /usr/local'
osqlscript.sh: advice: use "osql -I DIR" where DIR unixODBC\'s install
prefix e.g. /usr/local
+ echo 'isql strings are:'
isql strings are:
+ strings /usr/bin/isql
+ grep '^/'
+ sed 's/^/+ /'
+ /lib/ld-linux.so.2
+ '[' '' ']'
+ echo 'checking odbc.ini files'
checking odbc.ini files
+ for F in '"${HOME}/.odbc.ini"' '"${ODBC_DIR}/odbc.ini"'
++ dirname /root/.odbc.ini
+ '[' '!' -d /root ']'
+ '[' -r /root/.odbc.ini ']'
+ echo '    reading' '"/root/.odbc.ini"'
    reading "/root/.odbc.ini"
+ grep '[TEST]' /root/.odbc.ini
+ '[' 0 -eq 0 ']'
+ echo '[TEST]' found in '"/root/.odbc.ini"'
[TEST] found in "/root/.odbc.ini"
+ ODBC_INI=/root/.odbc.ini
+ break
+ '[' -z /root/.odbc.ini ']'
+ echo found this section:
found this section:
+ SED_CMD='/^\[TEST\]/,/^[[:space:]]*$/ { s/^/    /; p; }'
+ sed -ne '/^\[TEST\]/,/^[[:space:]]*$/ { s/^/    /; p; }' /root/.odbc.ini
    [TEST]
    Driver          = FreeTDS
    #Driver          = /usr/lib/odbc/libtdsodbc.so
    Description             = A good description of your DB
    Trace           = Yes
    Server          = [10.10.10.51]
    Port            = 1433
    TDS_Version     = 7.0
    
+ for D in '"${DSN}"' ''\''default'\'''
+ echo 'looking for driver for DSN [TEST]'
looking for driver for DSN [TEST]
+ grep TEST /root/.odbc.ini
+ '[' 0 -eq 0 ']'
+ CMD='/^\[TEST\]/,/^[[:space:]]*$/ { s/^/    /; p; }'
++ sed -ne '/^\[TEST\]/,/^[[:space:]]*$/ { s/^/    /; p; }' /root/.odbc.ini
++ grep -Ei '^[[:space:]]*driver[[:space:]]*='
+ DRIVER_LINE='    Driver          = FreeTDS'
+ '[' -z '    Driver          = FreeTDS' ']'
++ echo Driver = FreeTDS
++ awk -F = '{print $2}'
++ sed 's/[[:space:]][[:space:]]*//g'
+ DRIVER=FreeTDS
+ '[' FreeTDS ']'
++ basename /root/.odbc.ini
+ echo 'driver "FreeTDS" found for [TEST] in .odbc.ini'
driver "FreeTDS" found for [TEST] in .odbc.ini
+ break
+ '[' -z FreeTDS ']'
+ echo found driver named '"FreeTDS"'
found driver named "FreeTDS"
+ '[' '!' -r FreeTDS ']'
+ DRIVERNAME=FreeTDS
+ ODBC_INST=/odbcinst.ini
+ echo 'FreeTDS is not a readable file'
FreeTDS is not a readable file
+ echo 'looking for entry named [FreeTDS] in /odbcinst.ini'
looking for entry named [FreeTDS] in /odbcinst.ini
+ grep FreeTDS /odbcinst.ini
grep: /odbcinst.ini: No such file or directory
+ '[' 2 -ne 0 ']'
+ '[' 0 -eq 1 ']'
+ exit 1


On 7/16/09 4:40 PM, "[email protected]" <[email protected]>
wrote:

> On Thu, Jul 16, 2009 at 04:03:23PM +0200, Jaap van Arragon wrote:
>> SERVER:~# awk -W version
>> mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
>> 
>> compiled limits:
>> max NF             32767
>> sprintf buffer      1020
>> 
>> What can I do? Everything seems to be right but it and working....;-(
> 
> Hi Jaap, 
> 
> Well, from my perspective there are two problems: A) osql is broken (because
> mawk is), and B) your ODBC setup isn't working.
> 
> Regarding (B), let's follow Frediano's suggestion:
> 
> $ TDSDUMPCONFIG=stderr TDSDUMP=stderr \
> isql -v svr usr pwd
> 
> Let's see what that reports.  I still think your DM is reading an odbc.ini
> other than the one you're modifying.
> 
> Regarding (A), let's try Steve's suggestion.  In the osql script, find the
> only line that uses awk with that form of regular expression:
> 
> awk -F '[[:space:]]*=[[:space:]]*' '{print $2}')
> 
> replace it with
> 
> awk -F '=' '{print $2}' | sed 's/[[:space:]][[:space:]]*//g')
> 
> I committed revision 1.11 with that change.  You can download it from CVS.
> 
> One of those two things should tell us something.
> 
> Regards, 
> 
> --jkl
> _______________________________________________
> 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.