Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problem with the latest Sybase ODBC driver

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Igor Korot <ikorot01 AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problem with the latest Sybase ODBC driver
  • Date: Sat, 7 Jul 2018 12:48:29 -0500

Frediano,
So I did check the sources and it looks like under non-Windows
platforms the driver doesn't support
asking for the login information.

So I changed my code a bit passing SQL_DRIVER_NOPROMPT to SQLDriverConnect.

However, I still can't connect.

So I turned on the logging on freeTDS.

Attached please find 2 freeTDS log files:
- one is from the isql unixODBC session which is successful
- other is from my software which uses SQLDriverConnect which fails.

Both are produced with TDSDUMP environment variable.
By looking at those logs it looks like I have to retrieve the
userid/password pair and supply it
to the connection string.
But I thought that this is the job of the driver. Was I wrong?

If you need any more information let me know.

I am trying to connect to Sybase 16 server using freeTDS 1.00.14 and
unixODBC 2.3.5.

Thank you.


On Fri, Jul 6, 2018 at 10:16 PM, Igor Korot <ikorot01 AT gmail.com> wrote:
> Frediano,
>
> On Tue, Jul 3, 2018 at 12:09 AM, Frediano Ziglio <freddy77 AT gmail.com> wrote:
>> 2018-07-01 6:08 GMT+01:00 Igor Korot <ikorot01 AT gmail.com>:
>>> Frediano,
>>>
>>> On Sat, Jun 30, 2018 at 8:08 PM, Igor Korot <ikorot01 AT gmail.com> wrote:
>>>> Frediano,
>>>> Any idea why freeTDS fails to connect?
>>>
>>
>> Too many issues in this thread, I'm a bit confused, from Sybase
>> libraries to crash to ODBC settings, I'll try to reply to this one
>>
>>> I was able to connect with tsql by adding to freetds.conf:
>>>
>>> [code]
>>> [MySybase]
>>> host = IGORREINCLOUD
>>> port = 5000
>>> tds version = 5.0
>>> [/code]
>>>
>>> and then doing from the command prompt:
>>>
>>> [code]
>>> igor@IgorReinCloud ~/dbhandler $ tsql -S MySybase -U dba -P wasqra
>>> locale is "en_US.utf8"
>>> locale charset is "UTF-8"
>>> using default charset "UTF-8"
>>> Msg 4002 (severity 14, state 1) from IGORREINCLOUD:
>>> "Login failed.
>>> "
>>
>> This is failing, I suspect you are trying a wrong user/password
>>
>>> There was a problem connecting to the server
>>> igor@IgorReinCloud ~/dbhandler $ tsql -S MySybase -U sa -P wasqra
>>> locale is "en_US.utf8"
>>> locale charset is "UTF-8"
>>> using default charset "UTF-8"
>>> Msg 5704 (severity 10, state 1) from IGORREINCLOUD:
>>> "Changed client character set setting to 'iso_1'.
>>> "
>>
>> This is a successful connection.
>>
>>> 1> USE draft;
>>> 2> go
>>> Msg 102 (severity 15, state 181) from IGORREINCLOUD Line 1:
>>> "Incorrect syntax near ';'.
>>> "
>>> 1> USE draft
>>> 2> go
>>> 1> SELECT * FROM leagues
>>> 2> go
>>> id name drafttype scoringtype roundvalues leaguetype
>>> salary benchplayers
>>> 1 Demo - Roto (Auction) 1 1 1 demo 260 0
>>> 2 Demo - Roto (Draft) 3 1 1 demo 260 0
>>> 3 Demo - Points (Auction) 1 2 1 demo 260 0
>>> 4 Demo - Points (Draft) 3 2 1 demo 260 0
>>> (4 rows affected)
>>> 1> quit
>>> igor@IgorReinCloud ~/dbhandler $
>>> [/code]
>>>
>>> Do you see any issues with my freeTDS ODBC configuration?
>>>
>>
>> Looking back at ODBC I would say the option is "TDS_Version", not "TDS
>> Version", see http://www.freetds.org/userguide/odbcconnattr.htm.
>> Usually the steps I take are setting up tsql, then use "Servername" in
>> odbc.ini then more from freetds.conf to odbc.ini the various settings
>> to get an odbc only configuration.
>>
>> At the beginning you were using Sybase drivers, with FreeTDS you can
>> use TDSDUMP and TDSDUMPCONFIG environment to help debugging, see
>> http://www.freetds.org/userguide/logging.htm.
>
> So the unixODBC isql connection worked.
> Now I tried to connect from my program. It failed.
>
> Here are the lines from the sql.log files:
>
> [code]
> [ODBC][27195][1530943457.280532][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][290]
> Entry:
> Connection = 0x292cc00
> Window Hdl = 0x28c62a0
> Str In =
> [DSN=Sybase_16_freeTDS;Driver=Sybase_freeTDS][length = 43 (SQL_NTS)]
> Str Out = 0x2a87400
> Str Out Max = 1024
> Str Out Ptr = 0x7ffcb68b6550
> Completion = 1
> UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'
>
> [ODBC][27195][1530943457.327913][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLDriverConnectW.c][699]
> Exit:[SQL_ERROR]
> [ODBC][27195][1530943457.328028][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
> Entry:
> Connection = 0x292cc00
> Rec Number = 1
> SQLState = 0x7ffcb68b60d0
> Native = 0x7ffcb68b60a4
> Message Text = 0x7ffcb68b6100
> Buffer Length = 1024
> Text Len Ptr = 0x7ffcb68b609c
> [ODBC][27195][1530943457.328082][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
> Exit:[SQL_SUCCESS]
> SQLState = [HYC00]
> Native = 0x7ffcb68b60a4 -> 0
> Message Text = [[FreeTDS][SQL Server]Driver not capable]
> [ODBC][27195][1530943457.328149][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
> Entry:
> Connection = 0x292cc00
> Rec Number = 2
> SQLState = 0x7ffcb68b60d0
> Native = 0x7ffcb68b60a4
> Message Text = 0x7ffcb68b6100
> Buffer Length = 1024
> Text Len Ptr = 0x7ffcb68b609c
> [ODBC][27195][1530943457.328198][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
> Exit:[SQL_SUCCESS]
> SQLState = [08001]
> Native = 0x7ffcb68b60a4 -> 0
> Message Text = [[FreeTDS][SQL Server]Unable to connect to
> data source]
> [ODBC][27195][1530943457.328247][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][516]
> Entry:
> Connection = 0x292cc00
> Rec Number = 3
> SQLState = 0x7ffcb68b60d0
> Native = 0x7ffcb68b60a4
> Message Text = 0x7ffcb68b6100
> Buffer Length = 1024
> Text Len Ptr = 0x7ffcb68b609c
> [ODBC][27195][1530943457.328283][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLGetDiagRecW.c][563]
> Exit:[SQL_NO_DATA]
> [ODBC][27195][1530943462.470074][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][290]
> Entry:
> Handle Type = 2
> Input Handle = 0x292cc00
> [ODBC][27195][1530943462.470352][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][339]
> Exit:[SQL_SUCCESS]
> [ODBC][27195][1530943462.470433][/var/tmp/portage/dev-db/unixODBC-2.3.5-r1/work/unixODBC-2.3.5/DriverManager/SQLFreeHandle.c][220]
> Entry:
> Handle Type = 1
> Input Handle = 0x29b6d20
> [/code]
>
> I presume the "Driver not capable" error comes from the "Completion"
> parameter?
> Or there is something else?
>
> Please advise.
>
> Thank you.
>
>>
>>> Thank you.
>>>
>>>>
>>>> Thank you.
>>>>
>>>>
>>>> On Thu, Jun 28, 2018 at 8:02 AM, John Kendall <john AT capps.com> wrote:
>>>>>
>>>>>> On Jun 28, 2018, at 5:36 AM, Igor Korot <ikorot01 AT gmail.com> wrote:
>>>>>>
>>>>>> Hi, John,
>>>>>>
>>>>>> On Wed, Jun 27, 2018 at 11:14 AM, John Kendall <john AT capps.com> wrote:
>>>>>>> Igor,
>>>>>>> I'm on Centos 7.5 and it looks like I'm using the exact same version
>>>>>>> of ASE:
>>>>>>> Adaptive Server Enterprise/16.0 SP02 PL02/EBF 25320
>>>>>>> SMP/P/x86_64/Enterprise Linux/ase160sp02plx/2492/64-bit/FBO/Sat Nov
>>>>>>> 21 04:05:39 2015
>>>>>>>
>>>>>>> I'm using unixODBC 2.3.1 and the freeTDS odbc driver without issue.
>>>>>>> I recall having the Sybase ODBC driver working, but settled on the
>>>>>>> FreeTDS driver for simplicity.
>>>>>>
>>>>>> This is my setup:
>>>>>>
>>>>>> [code]
>>>>>> igor@IgorReinCloud ~/dbhandler $ cat /etc/unixODBC/odbcinst.ini
>>>>>> [ODBC]
>>>>>> Trace=yes
>>>>>> TraceFile=/tmp/sql.log
>>>>>> Pooling=No
>>>>>>
>>>>>> [Sybase]
>>>>>> Description=Sybase 16 Native Driver
>>>>>> Driver=/opt/sap/DataAccess64/ODBC/lib/libsybdrvodb.so
>>>>>> UsageCount=1
>>>>>>
>>>>>> [Sybase_freeTDS]
>>>>>> Description=Sybase FreeTDS Driver
>>>>>> Driver=/usr/lib64/libtdsodbc.so
>>>>>> UsageCount=1
>>>>>> igor@IgorReinCloud ~/dbhandler $ cat /etc/unixODBC/odbc.ini
>>>>>> [ODBC Data Sources]
>>>>>> Sybase_16_demo=Sybase 16 ODBC driver
>>>>>> Sybase_16_test=Sybase 16 ODBC driver
>>>>>> Sybase_16_freeTDS=Sybase_freeTDS
>>>>>>
>>>>>> [Sybase_16_demo]
>>>>>> Description=Sybase 16 ODBC Driver
>>>>>> Driver=Sybase
>>>>>> Port=5000
>>>>>> Server=IGORREINCLOUD
>>>>>> UserID=sa
>>>>>> Password=
>>>>>> Database=pubs2
>>>>>> Option=3
>>>>>>
>>>>>> [Sybase_16_test]
>>>>>> Description=Sybase 16 ODBC native driver
>>>>>> Driver=Sybase
>>>>>> Port=5000
>>>>>> Server=IG
>>>>>> Server=IGORREINCLOUD
>>>>>> UserID=sa
>>>>>> Password=
>>>>>> Database=draft
>>>>>> Option=3
>>>>>>
>>>>>> [Sybase_16_freeTDS]
>>>>>> Description=Sybase 16 freeTDS ODBC driver
>>>>>> Driver=Sybase_freeTDS
>>>>>> Port=5000
>>>>>> Server=IGORREINCLOUD
>>>>>> UserID=sa
>>>>>> Password=
>>>>>> Database=draft
>>>>>> TDS Version=5.0
>>>>>> Option=3
>>>>>> [/code]
>>>>>>
>>>>>> And this is from the ODBC log for freeTDS driver:
>>>>>>
>>>>>> [code]
>>>>>> [ODBC][15829][1530200010.883129][/var/tmp/portage/dev-db/unixODBC-2.3.2-r1/work/unixODBC-2.3.2/DriverManager/SQLConnect.c][3727]
>>>>>> Entry:
>>>>>> Connection = 0x637050
>>>>>> Server Name = [Sybase_16_freeTDS][length = 17 (SQL_NTS)]
>>>>>> User Name = [sa][length = 2 (SQL_NTS)]
>>>>>> Authentication = [******][length = 6 (SQL_NTS)]
>>>>>> UNICODE Using encoding ASCII 'UTF8' and UNICODE 'UTF16LE'
>>>>>>
>>>>>> DIAG [01000] [FreeTDS][SQL Server]Adaptive Server connection
>>>>>> failed
>>>>>>
>>>>>> DIAG [S1000] [FreeTDS][SQL Server]Unable to connect to data
>>>>>> source
>>>>>>
>>>>>> [ODBC][15829][1530200010.924065][/var/tmp/portage/dev-db/unixODBC-2.3.2-r1/work/unixODBC-2.3.2/DriverManager/SQLConnect.c][4099]
>>>>>> Exit:[SQL_ERROR]
>>>>>> [/code]
>>>>>>
>>>>>> The native driver works OK - I can connect without any issues.
>>>>>>
>>>>>> Do you see any problems?
>>>>>>
>>>>>> I'm trying to connect with:
>>>>>>
>>>>>> isql Sybase_16_freeTDS sa <password>
>>>>>>
>>>>>> Thank you.
>>>>>
>>>>> Upon further investigation, my ODBC success is via PHP. I am having
>>>>> problems with unixODBC isql as well.
>>>>> So I'm no help.
>>>>>
>>>>>>
>>>>>>>
>>>>>>> John
>>>>>>>
>>>>>>>
>>>>>>> On Jun 27, 2018, at 10:37 AM, Igor Korot
>>>>>>> <ikorot01 AT gmail.com<mailto:ikorot01 AT gmail.com>> wrote:
>>>>>>>
>>>>>>> Hi, ALL,
>>>>>>> This post is not directly related to the freeTDS, but I'm hoping that
>>>>>>> someone can help.
>>>>>>>
>>>>>>> I have a latest Sybase 16.0 version Development Edition installed on
>>>>>>> Linux.
>>>>>>> I also have a unixODBC installed.
>>>>>>>
>>>>>>> I'm trying to connect to the server using the default Sybase ODBC
>>>>>>> driver with the
>>>>>>> unixODBC isql program.
>>>>>>>
>>>>>>> Unfortunately I have a problem. The connection works, but then issuing
>>>>>>> the simple
>>>>>>> query, like "SELECT * FROM <my_table>;", where my table is
>>>>>>> locatedinside
>>>>>>> my local database (the one I created) segfaults.
>>>>>>> Trying to do the same with the Sybase demo database works fine.
>>>>>>>
>>>>>>> I didn't try to do anything with the freeTDS driver yet. I will
>>>>>>> probably do that
>>>>>>> over the weekend.
>>>>>>>
>>>>>>> Does anybody here have Sybase 16 installed? Did you try ODBC
>>>>>>> connection
>>>>>>> to the server?
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> P.S.: Software versions:
>>>>>>> 1> select @@version
>>>>>>> 2> go
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>>>>> Adaptive Server Enterprise/16.0 SP02 PL02/EBF 25320
>>>>>>> SMP/P/x86_64/Enterprise Lin
>>>>>>> ux/ase160sp02plx/2492/64-bit/FBO/Sat Nov 21 04:05:39 2015
>>>>>>>
>>>>>>> (1 row affected)
>>>>>>> 1> exit
>>>>>>>
>>>>>>> [/code]
>>>>>>>
>>>>>>> [code]
>>>>>>>
>>>>>>> [ebuild U ] dev-db/unixODBC-2.3.5-r1::gentoo [2.3.2-r1::gentoo]
>>>>>>> USE="minimal unicode -odbcmanual -static-libs" ABI_X86="32 (64)
>>>>>>> (-x32)" 1,596 KiB
>>>>>>>
>>>>>>> [/code]
>>>>>>>
>>>>>>> The current version of unixODBC is 2.3.2-r1 from gentoo repository.
>>
>> Not much experience with Gentoo, looks like directories are completely
>> different.
>>
>> Frediano
>> _______________________________________________
>> FreeTDS mailing list
>> FreeTDS AT lists.ibiblio.org
>> https://lists.ibiblio.org/mailman/listinfo/freetds

Attachment: freetds.log.fail
Description: Binary data

Attachment: freetds.log.success
Description: Binary data




Archive powered by MHonArc 2.6.24.

Top of Page