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

Jaap van Arragon j.vanarragon at lukkien.com
Fri Jul 17 07:28:55 EDT 2009


I've succesfully connected to our specific database through odbc.ini file.

@--jkl

If you want me to test more OSQL functionality I gladly want to help!


On 7/17/09 12:22 PM, "Jaap van Arragon" <j.vanarragon at lukkien.com> wrote:

> I already figured it out. ;-)
> 
> How can I connect through a specific databse through isql or must set in in
> my odbc ini file?
> 
> 
> On 7/17/09 11:55 AM, "Frediano Ziglio" <freddy77 at gmail.com> wrote:
> 
>> Well...now you should issue sql server command, not MySQL ones...
> 
> Try
>> "sp_tables" or "select * from sysobjects" or "select
>> @@version"
> 
> freddy77
> 
> 
> 2009/7/17 Jaap van Arragon
>> <j.vanarragon at lukkien.com>:
>> I am connected to ISQL now!
>> 
>> Everything I do
>> ends up in a error:
>> 
>> SERVER:~# isql TEST admin pass
>> 
>> +---------------------------------------+
>> | Connected!                      
>>      |
>> |                                       |
>> | sql-statement          
>>               |
>> | help [tablename]                      |
>> | quit          
>>                        |
>> |                                       |
>> 
>> +---------------------------------------+
>> SQL>
>> SQL> SHOW
>> [ISQL]ERROR:
>> Could not SQLExecute
>> SQL> SHOW TABLES;
>> [ISQL]ERROR: Could not SQLExecute
>> 
>> SQL> select * from table2222
>> [ISQL]ERROR: Could not SQLPrepare
>> 
>> How can I
>> verify my connection by looking at the available tables?
>> 
>> 
>> 
>> On 7/16/09
>> 5:52 PM, "Frediano Ziglio" <freddy77 at gmail.com> wrote:
>> 
>>> 
>>> Much clearer
>> !!!
>>> 
>>> you should replace [10.10.10.51] with only 10.10.10.51 (without
>> square
>>> brackets)!
>>> 
>>> freddy77
>>> 
>>> 
>>> Il giorno gio, 16/07/2009 alle
>> 17.33 +0200, Jaap van Arragon ha scritto:
>>>> hereby:
>>>> 
>>>> SERVER:~#
>> TDSDUMP=stderr isql TEST admin pass
>>>> log.c:190:Starting log file for
>> FreeTDS 0.82
>>>>     on 2009-07-16 17:33:20 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"
>>>> login.c:405:IP address pointer is empty
>>>> 
>> login.c:407:Server [10.10.10.51] not found!
>>>> 
>> mem.c:563:tds_free_all_results()
>>>> error.c:574:SQLError((nil), 0x80651e0,
>> (nil), 0xbf8df50e, 0xbf8df514,
>>>> 0xbf8df034, 513, 0xbf8df51e)
>>>> 
>> error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbf8df50e, 0xbf8df514,
>>>> 
>> 0xbf8df034, 513, 0xbf8df51e)
>>>> error.c:574:SQLError((nil), 0x80651e0, (nil),
>> 0xbf8df50e, 0xbf8df514,
>>>> 0xbf8df034, 513, 0xbf8df51e)
>>>> 
>> error.c:510:_SQLGetDiagRec(2, 0x80651e0, 1, 0xbf8df50e, 0xbf8df514,
>>>> 
>> 0xbf8df034, 513, 0xbf8df51e)
>>>> odbc.c:3734:SQLFreeConnect(0x80651e0)
>>>> 
>> odbc.c:3706:_SQLFreeConnect(0x80651e0)
>>>> 
>> odbc.c:3757:SQLFreeEnv(0x80645e8)
>>>> odbc.c:3744:_SQLFreeEnv(0x80645e8)
>>>> 
>> [ISQL]ERROR: Could not SQLConnect
>>>> 
>>>> 
>>>> 
>>>> On 7/16/09 5:31 PM,
>> "Frediano Ziglio" <freddy77 at gmail.com> wrote:
>>>> 
>>>>> Could you also
>> try
>>>>> 
>>>>> TDSDUMP=stderr isql TEST admin pass
>>>>> 
>>>>> where TEST is your
>> DSN, admin your account and pass your password ??
>>>>> 
>>>>> 
>> freddy77
>>>>> 
>>>>> 
>>>>> Il giorno gio, 16/07/2009 alle 17.17 +0200, Jaap van
>> Arragon ha scritto:
>>>>>> Thank you.
>>>>>> 
>>>>>> SERVER:~#
>> TDSDUMPCONFIG=stderr TDSDUMP=stderr \
>>>>>>> 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.16985
>>>>>> + 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.16985
>>>>>> + ODBC_DIR=
>>>>>> + rm
>> /tmp/osqlscript.sh.16985
>>>>>> + '[' -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 5:10 PM, "Daniel Fazekas" <fdsubs at t-online.hu> wrote:
>>>>>> 
>>>>>>> On
>> Jul 16, 2009, at 17:07, Jaap van Arragon wrote:
>>>>>>> 
>>>>>>>>> Regarding (B),
>> let's follow Frediano's suggestion:
>>>>>>>>> 
>>>>>>>>> $ TDSDUMPCONFIG=stderr
>> TDSDUMP=stderr \
>>>>>>>>> isql -v svr usr pwd
>>>>>>>> OPTION 1:
>>>>>>>> 
>> SERVER:~# TDSDUMPCONFIG=stderr TDSDUMP=stderr
>>>>>>>> SERVER:~# isql -v TEST
>> admin pass
>>>>>>> 
>>>>>>> You missed the slash \ at the end of the TDSDUMP
>> line.
>>>>>>> This way your enviromental variables are meaningless since they
>> are
>>>>>>> not exported.
>>>>>>> 
>>>>>>> 
>> _______________________________________________
>>>>>>> FreeTDS mailing
>> list
>>>>>>> FreeTDS at lists.ibiblio.org
>>>>>>> 
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>>>>> 
>>>>>> 
>>>>>> 
>> _______________________________________________
>>>>>> FreeTDS mailing
>> list
>>>>>> FreeTDS at lists.ibiblio.org
>>>>>> 
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>>>> 
>>>>> 
>> _______________________________________________
>>>>> FreeTDS mailing list
>>>>> 
>> FreeTDS at lists.ibiblio.org
>>>>> 
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>>> 
>>>> 
>>>> 
>> _______________________________________________
>>>> FreeTDS mailing list
>>>> 
>> FreeTDS at lists.ibiblio.org
>>>> 
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>>> 
>>> 
>> _______________________________________________
>>> FreeTDS mailing list
>>> 
>> FreeTDS at lists.ibiblio.org
>>> 
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>> 
>> 
>> 
>> _______________________________________________
>> FreeTDS mailing list
>> 
>> FreeTDS at lists.ibiblio.org
>> 
>> http://lists.ibiblio.org/mailman/listinfo/freetds
>> 
> __________________________
>> _____________________
> FreeTDS mailing
>> list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freet
>> ds
> 
> 
> 
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds




More information about the FreeTDS mailing list