From venkatakrishnat1 at gmail.com Thu Jan 1 07:28:24 2015 From: venkatakrishnat1 at gmail.com (venkata krishna Thaluru) Date: Thu, 1 Jan 2015 17:58:24 +0530 Subject: [freetds] FreeTds crashing Message-ID: Hi All, I have downloaded the following version(freetds-0.92.812) and stable version for 64 bit and compiled the source code. While connecting from sybase to MSSQL ,it is crashing . Could you please let me know whether we have addressed this issue in any versions and please share the exact version details. Thanks Venkata Krishna From freddy77 at gmail.com Thu Jan 1 13:28:58 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Thu, 1 Jan 2015 19:28:58 +0100 Subject: [freetds] FreeTds crashing In-Reply-To: References: Message-ID: 2015-01-01 13:28 GMT+01:00 venkata krishna Thaluru : > Hi All, > I have downloaded the following version(freetds-0.92.812) and stable > version for 64 bit and compiled the source code. > While connecting from sybase to MSSQL ,it is crashing . > > Could you please let me know whether we have addressed this issue in any > versions and please share the exact version details. > > > Thanks > Venkata Krishna Hi, should not crash surely, unless API used incorrectly. Frediano From venkatakrishnat1 at gmail.com Sun Jan 4 11:15:51 2015 From: venkatakrishnat1 at gmail.com (venkata krishna Thaluru) Date: Sun, 4 Jan 2015 21:45:51 +0530 Subject: [freetds] FreeTds crashing In-Reply-To: References: Message-ID: Thanks for reply Frediano, Can you please share the exact stable version number for 64 bit linux machine. I have tried with different sybase version like 12 and 16 .Still it is crashing . Thanks Venkata Krishna On Thu, Jan 1, 2015 at 11:58 PM, Frediano Ziglio wrote: > 2015-01-01 13:28 GMT+01:00 venkata krishna Thaluru < > venkatakrishnat1 at gmail.com>: > > Hi All, > > I have downloaded the following version(freetds-0.92.812) and stable > > version for 64 bit and compiled the source code. > > While connecting from sybase to MSSQL ,it is crashing . > > > > Could you please let me know whether we have addressed this issue in any > > versions and please share the exact version details. > > > > > > Thanks > > Venkata Krishna > > Hi, > should not crash surely, unless API used incorrectly. > > Frediano > -- *Thanks&RegardsVenkatakrishna.T* *HCL TECHNOLOGIES Ltd.09600185503/09908611807* From ikorot01 at gmail.com Mon Jan 5 07:31:32 2015 From: ikorot01 at gmail.com (Igor Korot) Date: Mon, 5 Jan 2015 07:31:32 -0500 Subject: [freetds] FreeTds crashing In-Reply-To: References: Message-ID: Hi, On Sun, Jan 4, 2015 at 11:15 AM, venkata krishna Thaluru wrote: > Thanks for reply Frediano, > Can you please share the exact stable version number for 64 bit linux > machine. > > I have tried with different sybase version like 12 and 16 .Still it is > crashing . Could you plrase post some code along with configuration files? Also gdb backtrace would be helpful... ;-) Thank you. > > Thanks > Venkata Krishna > > On Thu, Jan 1, 2015 at 11:58 PM, Frediano Ziglio wrote: > >> 2015-01-01 13:28 GMT+01:00 venkata krishna Thaluru < >> venkatakrishnat1 at gmail.com>: >> > Hi All, >> > I have downloaded the following version(freetds-0.92.812) and stable >> > version for 64 bit and compiled the source code. >> > While connecting from sybase to MSSQL ,it is crashing . >> > >> > Could you please let me know whether we have addressed this issue in any >> > versions and please share the exact version details. >> > >> > >> > Thanks >> > Venkata Krishna >> >> Hi, >> should not crash surely, unless API used incorrectly. >> >> Frediano >> > > > > -- > > *Thanks&RegardsVenkatakrishna.T* > > *HCL TECHNOLOGIES Ltd.09600185503/09908611807* > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds From Adrian.Nye at dimensional.com Tue Jan 6 10:32:50 2015 From: Adrian.Nye at dimensional.com (Adrian.Nye at dimensional.com) Date: Tue, 6 Jan 2015 15:32:50 +0000 Subject: [freetds] Unexpected EOF Message-ID: Hello, I?m a first time poster to this list. I am having a problem running TDS 0.91 on Mac OSX 10.9 (Mavericks) using a homebrew installation, where I can no longer connect to Microsoft SQL. The connection was working fine, but some unknown change broke it, and I cannot seem to recover. I did a brew update, then reinstalled unixodbc first, then reinstalled freetds with the ?with-unixodbc option. The output of tsql ?C is: Version: freetds v0.91 freetds.conf directory: /usr/local/Cellar/freetds/0.91_2/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 7.1 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: no I am using the following command for testing: TDSVER=7.1 TDSDUMP=/tmp/freetds.log tsql -H -p 1433 -U -P I have confirmed using telnet that I can connect to the MSSQL server on port 1433. The TDSVER, host, username, password, and port are all known correct because this command line works on another developer?s identical laptop. He gets the tsql prompt as expected. What I get is: locale is "en_US.utf-8" locale charset is "utf-8" using default charset "utf-8" Error 20017 (severity 9): Unexpected EOF from the server Error 20002 (severity 9): Adaptive Server connection failed There was a problem connecting to the server The tail of the connection log shows the following: net.c:741:Sending packet 0000 12 01 00 ce 00 00 00 00-16 03 01 00 86 10 00 00 |...##... ........| 0010 82 00 80 6b 5a c8 0c d1-c0 da 5c 6a 77 93 de 55 |...kZ######\jw.##| 0020 16 55 5f ec a7 04 09 1c-4a 67 0e 55 71 83 93 f9 |.U_###.. Jg.Uq..#####030 d5 68 c0 15 9a 12 03 4e-ff 90 a6 dd c0 18 35 dd |####...N .###.5## 0040 34 f9 53 26 2c 44 2a 3a-4c dd 3c 76 b7 1b 89 bd |4#####*: L##v#..#| 0050 4d 54 03 b6 80 85 57 11-76 c9 2f 47 80 52 02 a5 |MT.#..W. v##G.R.#| 0060 e5 7a 47 0b cd 73 7d 67-ec 28 12 76 3f f7 ef e4 |###.##}g ###v?#### 0070 d0 ff ad 74 bc ed fe da-e8 cb 85 17 00 fc 23 2a |###t#### ###..######0080 c9 56 d9 1c 4f c8 0f 5c-96 be 09 17 44 bf 7a a1 |####O##\ .#..D#z#| 0090 af 37 6d 14 03 01 00 01-01 16 03 01 00 30 64 03 |#7m..... .....0d.| 00a0 fb bf 62 33 d7 68 b4 63-6c c2 52 51 b3 da 67 06 |#####h#c l##Q###.| 00b0 f0 c4 a9 5f db e5 87 ee-37 a9 5c bd e0 2a 6e b7 |######.####\#####| 00c0 0f 2a 94 b6 c1 33 23 3e-7b fb 75 66 57 1f |.*.####> {#####| net.c:1199:in tds_pull_func net.c:1212:have 0 net.c:1216:before read net.c:555:Received header 0000 12 01 00 43 00 00 00 00- |...C....| net.c:609:Received packet 0000 12 01 00 43 00 00 00 00-14 03 01 00 01 01 16 03 |...C.... ........| 0010 01 00 30 86 93 2b 59 46-af 12 50 b1 cc bb df 86 |..0..+YF #.P#?##| 0020 53 83 a2 77 4f 69 da b5-b9 11 34 b0 e4 3a 34 58 |S.#wOi? #.4####X| 0030 5a d8 16 c7 a0 5b 44 56-7c 96 d4 cd 9d 83 b4 57 |Z####[DV |.##..#W| 0040 a1 a5 a4 - |###| net.c:1219:after read net.c:1212:have 59 net.c:1223:read 5 bytes net.c:1199:in tds_pull_func net.c:1212:have 54 net.c:1223:read 1 bytes net.c:1199:in tds_pull_func net.c:1212:have 53 net.c:1223:read 5 bytes net.c:1199:in tds_pull_func net.c:1212:have 48 net.c:1223:read 48 bytes net.c:1519:handshake succeeded!! login.c:782:quietly sending TDS 7+ login packet token.c:328:tds_process_login_tokens() util.c:331:tdserror(0x7faceb404120, 0x7faceb404230, 20017, 0) util.c:361:tdserror: client library returned TDS_INT_CANCEL(2) util.c:384:tdserror: returning TDS_INT_CANCEL(2) util.c:156:Changed query state from IDLE to DEAD token.c:337:looking for login token, got 0() token.c:122:tds_process_default_tokens() marker is 0() token.c:125:leaving tds_process_default_tokens() connection dead login.c:466:login packet accepted util.c:331:tdserror(0x7faceb404120, 0x7faceb404230, 20002, 0) util.c:361:tdserror: client library returned TDS_INT_CANCEL(2) util.c:384:tdserror: returning TDS_INT_CANCEL(2) mem.c:615:tds_free_all_results() I have tried everything I know to fix this. Can anyone suggest a next step? Thanks Adrian This message and any attachments (the "Message") may contain confidential, proprietary and/or privileged information and are only for their intended recipient(s). If you are not the intended recipient, you should notify the sender and delete the Message. E-mail transmissions cannot be guaranteed to be secure or error-free. This Message is provided for information purposes and should not be construed as a solicitation or offer to buy or sell any securities or financial instruments, or to provide investment advice in any jurisdiction where the sender is not properly licensed or permitted to do so. This Message is subject to additional conditions and restrictions. Please read them here: http://legal.dimensional.com/email/ From Adrian.Nye at dimensional.com Tue Jan 6 15:18:42 2015 From: Adrian.Nye at dimensional.com (Adrian.Nye at dimensional.com) Date: Tue, 6 Jan 2015 20:18:42 +0000 Subject: [freetds] Unexpected EOF Message-ID: Solved: I set LC_ALL=en_US.UTF-8 in my ~/.bash_profile and start a new terminal, and now it works. Before the fix, I checked the SQL log and it was showing: The login packet used to open the connection is structurally invalid It may be a tsql bug that it prints 'locale is "en_US.UTF-8?' when apparently it was actually not using UTF-8. On 1/6/15, 9:32 AM, "Adrian.Nye at dimensional.com" wrote: > >Hello, I?m a first time poster to this list. > >I am having a problem running TDS 0.91 on Mac OSX 10.9 (Mavericks) using >a homebrew installation, where I can no longer connect to Microsoft SQL. > The connection was working fine, but some unknown change broke it, and >I cannot seem to recover. > >I did a brew update, then reinstalled unixodbc first, then reinstalled >freetds with the ?with-unixodbc option. > >The output of tsql ?C is: > > Version: freetds v0.91 > freetds.conf directory: /usr/local/Cellar/freetds/0.91_2/etc > MS db-lib source compatibility: no > Sybase binary compatibility: no > Thread safety: yes > iconv library: yes > TDS version: 7.1 > iODBC: no > unixodbc: yes > SSPI "trusted" logins: no > Kerberos: no > >I am using the following command for testing: > >TDSVER=7.1 TDSDUMP=/tmp/freetds.log tsql -H -p 1433 -U >-P > >I have confirmed using telnet that I can connect to the MSSQL server on >port 1433. > >The TDSVER, host, username, password, and port are all known correct >because this command line works on another developer?s identical laptop. >He gets the tsql prompt as expected. What I get is: > >locale is "en_US.utf-8" >locale charset is "utf-8" >using default charset "utf-8" >Error 20017 (severity 9): > Unexpected EOF from the server >Error 20002 (severity 9): > Adaptive Server connection failed >There was a problem connecting to the server > >The tail of the connection log shows the following: > >net.c:741:Sending packet >0000 12 01 00 ce 00 00 00 00-16 03 01 00 86 10 00 00 |...##... ........| >0010 82 00 80 6b 5a c8 0c d1-c0 da 5c 6a 77 93 de 55 |...kZ######\jw.##| >0020 16 55 5f ec a7 04 09 1c-4a 67 0e 55 71 83 93 f9 |.U_###.. >Jg.Uq..#####030 d5 68 c0 15 9a 12 03 4e-ff 90 a6 dd c0 18 35 dd |####...N >.###.5## >0040 34 f9 53 26 2c 44 2a 3a-4c dd 3c 76 b7 1b 89 bd |4#####*: L##v#..#| >0050 4d 54 03 b6 80 85 57 11-76 c9 2f 47 80 52 02 a5 |MT.#..W. v##G.R.#| >0060 e5 7a 47 0b cd 73 7d 67-ec 28 12 76 3f f7 ef e4 |###.##}g ###v?#### >0070 d0 ff ad 74 bc ed fe da-e8 cb 85 17 00 fc 23 2a |###t#### >###..######0080 c9 56 d9 1c 4f c8 0f 5c-96 be 09 17 44 bf 7a a1 |####O##\ >.#..D#z#| >0090 af 37 6d 14 03 01 00 01-01 16 03 01 00 30 64 03 |#7m..... .....0d.| >00a0 fb bf 62 33 d7 68 b4 63-6c c2 52 51 b3 da 67 06 |#####h#c l##Q###.| >00b0 f0 c4 a9 5f db e5 87 ee-37 a9 5c bd e0 2a 6e b7 |######.####\#####| >00c0 0f 2a 94 b6 c1 33 23 3e-7b fb 75 66 57 1f |.*.####> {#####| > >net.c:1199:in tds_pull_func >net.c:1212:have 0 >net.c:1216:before read >net.c:555:Received header >0000 12 01 00 43 00 00 00 00- |...C....| > >net.c:609:Received packet >0000 12 01 00 43 00 00 00 00-14 03 01 00 01 01 16 03 |...C.... ........| >0010 01 00 30 86 93 2b 59 46-af 12 50 b1 cc bb df 86 |..0..+YF #.P#?##| >0020 53 83 a2 77 4f 69 da b5-b9 11 34 b0 e4 3a 34 58 |S.#wOi? #.4####X| >0030 5a d8 16 c7 a0 5b 44 56-7c 96 d4 cd 9d 83 b4 57 |Z####[DV |.##..#W| >0040 a1 a5 a4 - |###| > >net.c:1219:after read >net.c:1212:have 59 >net.c:1223:read 5 bytes >net.c:1199:in tds_pull_func >net.c:1212:have 54 >net.c:1223:read 1 bytes >net.c:1199:in tds_pull_func >net.c:1212:have 53 >net.c:1223:read 5 bytes >net.c:1199:in tds_pull_func >net.c:1212:have 48 >net.c:1223:read 48 bytes >net.c:1519:handshake succeeded!! >login.c:782:quietly sending TDS 7+ login packet >token.c:328:tds_process_login_tokens() >util.c:331:tdserror(0x7faceb404120, 0x7faceb404230, 20017, 0) >util.c:361:tdserror: client library returned TDS_INT_CANCEL(2) >util.c:384:tdserror: returning TDS_INT_CANCEL(2) >util.c:156:Changed query state from IDLE to DEAD >token.c:337:looking for login token, got 0() >token.c:122:tds_process_default_tokens() marker is 0() >token.c:125:leaving tds_process_default_tokens() connection dead >login.c:466:login packet accepted >util.c:331:tdserror(0x7faceb404120, 0x7faceb404230, 20002, 0) >util.c:361:tdserror: client library returned TDS_INT_CANCEL(2) >util.c:384:tdserror: returning TDS_INT_CANCEL(2) >mem.c:615:tds_free_all_results() > >I have tried everything I know to fix this. Can anyone suggest a next >step? > >Thanks >Adrian >This message and any attachments (the "Message") may contain >confidential, proprietary and/or privileged information and are only for >their intended recipient(s). If you are not the intended recipient, you >should notify the sender and delete the Message. E-mail transmissions >cannot be guaranteed to be secure or error-free. This Message is provided >for information purposes and should not be construed as a solicitation or >offer to buy or sell any securities or financial instruments, or to >provide investment advice in any jurisdiction where the sender is not >properly licensed or permitted to do so. This Message is subject to >additional conditions and restrictions. Please read them here: >http://legal.dimensional.com/email/ >_______________________________________________ >FreeTDS mailing list >FreeTDS at lists.ibiblio.org >http://lists.ibiblio.org/mailman/listinfo/freetds This message and any attachments (the "Message") may contain confidential, proprietary and/or privileged information and are only for their intended recipient(s). If you are not the intended recipient, you should notify the sender and delete the Message. E-mail transmissions cannot be guaranteed to be secure or error-free. This Message is provided for information purposes and should not be construed as a solicitation or offer to buy or sell any securities or financial instruments, or to provide investment advice in any jurisdiction where the sender is not properly licensed or permitted to do so. This Message is subject to additional conditions and restrictions. Please read them here: http://legal.dimensional.com/email/ From velichko.yuriy at gmail.com Fri Jan 16 02:12:36 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Fri, 16 Jan 2015 09:12:36 +0200 Subject: [freetds] How to hash of the password string for query? Message-ID: Hello! Sorry if this question is offtop in this list, but I hope that you can help me. I use freetds to communicate with SQL Server. To create a server login I should to use query CREATE LOGIN ... PASSWORD hashed_password HASHED Advise me, please, how should I get the hashed_password properly? May be there is a particular function in freetds for this purpose? Thanks! From freddy77 at gmail.com Fri Jan 16 04:52:06 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 16 Jan 2015 09:52:06 +0000 Subject: [freetds] How to hash of the password string for query? In-Reply-To: References: Message-ID: 2015-01-16 7:12 GMT+00:00 Velichko Yuriy : > Hello! Sorry if this question is offtop in this list, but I hope that you > can help me. > > I use freetds to communicate with SQL Server. > To create a server login I should to use query > > CREATE LOGIN ... PASSWORD hashed_password HASHED > > Advise me, please, how should I get the hashed_password properly? May be > there is a particular function in freetds for this purpose? > > Thanks! Hi, you have to use the server. See https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f15a1ee1-e1df-4b51-987d-c1b094f2e71e/request-actual-example-of-create-login-with-password-hashed?forum=sqlsecurity. Regards, Frediano From velichko.yuriy at gmail.com Fri Jan 16 05:42:00 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Fri, 16 Jan 2015 12:42:00 +0200 Subject: [freetds] How to hash of the password string for query? In-Reply-To: References: Message-ID: Thanks! This is a good tutorial to solve my problem. On 16 January 2015 at 11:52, Frediano Ziglio wrote: > 2015-01-16 7:12 GMT+00:00 Velichko Yuriy : > > Hello! Sorry if this question is offtop in this list, but I hope that you > > can help me. > > > > I use freetds to communicate with SQL Server. > > To create a server login I should to use query > > > > CREATE LOGIN ... PASSWORD hashed_password HASHED > > > > Advise me, please, how should I get the hashed_password properly? May be > > there is a particular function in freetds for this purpose? > > > > Thanks! > > Hi, > you have to use the server. See > > https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f15a1ee1-e1df-4b51-987d-c1b094f2e71e/request-actual-example-of-create-login-with-password-hashed?forum=sqlsecurity > . > > Regards, > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > -- ?? ?????????, ??????? ????. From gregory.holtorf at gmail.com Fri Jan 16 17:17:04 2015 From: gregory.holtorf at gmail.com (Gregory Holtorf) Date: Fri, 16 Jan 2015 16:17:04 -0600 Subject: [freetds] Adding NVARCHAR columns causes ct_cancel (ctlib) to hang Message-ID: When calling ct_cancel in the freetds library, on unix, ct_cancel() sometimes takes several minutes to run. This is bad because it usually takes a few milliseconds to run. This bug works on freetds-0.91 and freetds-0.64 In order to reproduce the bug, I needed to: 1. Run a select statement on a large table 2. The table has to contain nvarchar columns. varchar columns do not trigger the bug. 3. The select statement must contain an order by clause select from order by After completing the select statement, call ct_cancel(). For instance, before you make another select statement or when you log out. ct_cancel(m_pCtConnection, NULL, CS_CANCEL_ALL); When I turn on logging I can see that after I call ct_cancel() for the last time, it is followed by an absolutely huge number of packets received. I attached a log file, but I had to force quit the program or else the log file ends up being several thousand megabytes long. Is there a way to fix this issue? Is freetds unable to make select statements on nvarchar columns or is it something I did in my code? Thanks, Greg -------------- next part -------------- A non-text attachment was scrubbed... Name: freetds.log Type: application/octet-stream Size: 260375 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: slowdowntest.cpp Type: text/x-c++src Size: 13985 bytes Desc: not available URL: From freddy77 at gmail.com Sun Jan 18 04:23:38 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 18 Jan 2015 09:23:38 +0000 Subject: [freetds] Adding NVARCHAR columns causes ct_cancel (ctlib) to hang In-Reply-To: References: Message-ID: 2015-01-16 22:17 GMT+00:00 Gregory Holtorf : > When calling ct_cancel in the freetds library, on unix, ct_cancel() > sometimes takes several minutes to run. This is bad because it usually > takes a few milliseconds to run. This bug works on freetds-0.91 and > freetds-0.64 In order to reproduce the bug, I needed to: > > 1. Run a select statement on a large table > > 2. The table has to contain nvarchar columns. varchar columns do not > trigger the bug. > > 3. The select statement must contain an order by clause > > > select > > from
> > order by > > > After completing the select statement, call ct_cancel(). For instance, > before you make another select statement or when you log out. > > ct_cancel(m_pCtConnection, NULL, CS_CANCEL_ALL); > > > When I turn on logging I can see that after I call ct_cancel() for the last > time, it is followed by an absolutely huge number of packets received. I > attached a log file, but I had to force quit the program or else the log > file ends up being several thousand megabytes long. > > Is there a way to fix this issue? Is freetds unable to make select > statements on nvarchar columns or is it something I did in my code? > > > Thanks, > > Greg > Hi, unfortunately is a server problem. Looking at the log FreeTDS correctly send the cancel request but server does not process it in a time fashion so at the end it output all results to client. The only problem can raise from FreeTDS is the conversion from nvarchar(max) -> ntext caused by protocol. You should try with git master version and 7.2 protocol. Frediano From gregory.holtorf at gmail.com Mon Jan 19 13:57:01 2015 From: gregory.holtorf at gmail.com (Gregory Holtorf) Date: Mon, 19 Jan 2015 12:57:01 -0600 Subject: [freetds] Adding NVARCHAR columns causes ct_cancel (ctlib) to hang In-Reply-To: References: Message-ID: I download the master version at https://gitorious.org/freetds/freetds/source/a8bafc940508adcb575d1d72b4ff456c9973f5e4: but that version apparently can't ./configure and make on unix (even though) some of the readme still says to do that. Is there a version that still works on unix? On Sun, Jan 18, 2015 at 3:23 AM, Frediano Ziglio wrote: > 2015-01-16 22:17 GMT+00:00 Gregory Holtorf : > > When calling ct_cancel in the freetds library, on unix, ct_cancel() > > sometimes takes several minutes to run. This is bad because it usually > > takes a few milliseconds to run. This bug works on freetds-0.91 and > > freetds-0.64 In order to reproduce the bug, I needed to: > > > > 1. Run a select statement on a large table > > > > 2. The table has to contain nvarchar columns. varchar columns do not > > trigger the bug. > > > > 3. The select statement must contain an order by clause > > > > > > select > > > > from
> > > > order by > > > > > > After completing the select statement, call ct_cancel(). For instance, > > before you make another select statement or when you log out. > > > > ct_cancel(m_pCtConnection, NULL, CS_CANCEL_ALL); > > > > > > When I turn on logging I can see that after I call ct_cancel() for the > last > > time, it is followed by an absolutely huge number of packets received. I > > attached a log file, but I had to force quit the program or else the log > > file ends up being several thousand megabytes long. > > > > Is there a way to fix this issue? Is freetds unable to make select > > statements on nvarchar columns or is it something I did in my code? > > > > > > Thanks, > > > > Greg > > > > Hi, > unfortunately is a server problem. Looking at the log FreeTDS > correctly send the cancel request but server does not process it in a > time fashion so at the end it output all results to client. The only > problem can raise from FreeTDS is the conversion from nvarchar(max) -> > ntext caused by protocol. You should try with git master version and > 7.2 protocol. > > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > From lacak at zoznam.sk Mon Jan 19 05:56:16 2015 From: lacak at zoznam.sk (LacaK) Date: Mon, 19 Jan 2015 11:56:16 +0100 Subject: [freetds] Next stable release Message-ID: <54BCE2D0.5090204@zoznam.sk> Hi, is there any plan, or time estimation for next (post 0.91) stable release of FreeTDS ? (as it is more than 3 years after 0.91 was released) If not, then is current git master stable enough? (or are there any work in progress changes?) Thanks -Laco. From ikorot01 at gmail.com Mon Jan 19 14:40:23 2015 From: ikorot01 at gmail.com (Igor Korot) Date: Mon, 19 Jan 2015 14:40:23 -0500 Subject: [freetds] Adding NVARCHAR columns causes ct_cancel (ctlib) to hang In-Reply-To: References: Message-ID: Hi, On Mon, Jan 19, 2015 at 1:57 PM, Gregory Holtorf wrote: > I download the master version at > https://gitorious.org/freetds/freetds/source/a8bafc940508adcb575d1d72b4ff456c9973f5e4: > but that version apparently can't ./configure and make on unix (even > though) some of the readme still says to do that. Is there a version that > still works on unix? Which OS you are working with? What is an error message you received? Is it from configure or make? How did you configure the library? Thank you. > > On Sun, Jan 18, 2015 at 3:23 AM, Frediano Ziglio wrote: > >> 2015-01-16 22:17 GMT+00:00 Gregory Holtorf : >> > When calling ct_cancel in the freetds library, on unix, ct_cancel() >> > sometimes takes several minutes to run. This is bad because it usually >> > takes a few milliseconds to run. This bug works on freetds-0.91 and >> > freetds-0.64 In order to reproduce the bug, I needed to: >> > >> > 1. Run a select statement on a large table >> > >> > 2. The table has to contain nvarchar columns. varchar columns do not >> > trigger the bug. >> > >> > 3. The select statement must contain an order by clause >> > >> > >> > select >> > >> > from
>> > >> > order by >> > >> > >> > After completing the select statement, call ct_cancel(). For instance, >> > before you make another select statement or when you log out. >> > >> > ct_cancel(m_pCtConnection, NULL, CS_CANCEL_ALL); >> > >> > >> > When I turn on logging I can see that after I call ct_cancel() for the >> last >> > time, it is followed by an absolutely huge number of packets received. I >> > attached a log file, but I had to force quit the program or else the log >> > file ends up being several thousand megabytes long. >> > >> > Is there a way to fix this issue? Is freetds unable to make select >> > statements on nvarchar columns or is it something I did in my code? >> > >> > >> > Thanks, >> > >> > Greg >> > >> >> Hi, >> unfortunately is a server problem. Looking at the log FreeTDS >> correctly send the cancel request but server does not process it in a >> time fashion so at the end it output all results to client. The only >> problem can raise from FreeTDS is the conversion from nvarchar(max) -> >> ntext caused by protocol. You should try with git master version and >> 7.2 protocol. >> >> Frediano >> _______________________________________________ >> 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 From gregory.holtorf at gmail.com Mon Jan 19 15:18:21 2015 From: gregory.holtorf at gmail.com (Gregory Holtorf) Date: Mon, 19 Jan 2015 14:18:21 -0600 Subject: [freetds] Adding NVARCHAR columns causes ct_cancel (ctlib) to hang In-Reply-To: References: Message-ID: ./configure: Command not found. When I do a diff between freetds v0.91 and freetds master version, the configure file is not there in the master. unmae -a says the OS version is: Linux nysv-vmpvdev6b.tpnyc.local 2.6.32-431.20.3.el6.x86_64 #1 SMP Fri Jun 6 18:30:54 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux On Mon, Jan 19, 2015 at 1:40 PM, Igor Korot wrote: > Hi, > > On Mon, Jan 19, 2015 at 1:57 PM, Gregory Holtorf > wrote: > > I download the master version at > > > https://gitorious.org/freetds/freetds/source/a8bafc940508adcb575d1d72b4ff456c9973f5e4 > : > > but that version apparently can't ./configure and make on unix (even > > though) some of the readme still says to do that. Is there a version > that > > still works on unix? > > Which OS you are working with? > What is an error message you received? Is it from configure or make? > How did you configure the library? > > Thank you. > > > > > On Sun, Jan 18, 2015 at 3:23 AM, Frediano Ziglio > wrote: > > > >> 2015-01-16 22:17 GMT+00:00 Gregory Holtorf : > >> > When calling ct_cancel in the freetds library, on unix, ct_cancel() > >> > sometimes takes several minutes to run. This is bad because it usually > >> > takes a few milliseconds to run. This bug works on freetds-0.91 and > >> > freetds-0.64 In order to reproduce the bug, I needed to: > >> > > >> > 1. Run a select statement on a large table > >> > > >> > 2. The table has to contain nvarchar columns. varchar columns do not > >> > trigger the bug. > >> > > >> > 3. The select statement must contain an order by clause > >> > > >> > > >> > select > >> > > >> > from
> >> > > >> > order by > >> > > >> > > >> > After completing the select statement, call ct_cancel(). For instance, > >> > before you make another select statement or when you log out. > >> > > >> > ct_cancel(m_pCtConnection, NULL, CS_CANCEL_ALL); > >> > > >> > > >> > When I turn on logging I can see that after I call ct_cancel() for the > >> last > >> > time, it is followed by an absolutely huge number of packets > received. I > >> > attached a log file, but I had to force quit the program or else the > log > >> > file ends up being several thousand megabytes long. > >> > > >> > Is there a way to fix this issue? Is freetds unable to make select > >> > statements on nvarchar columns or is it something I did in my code? > >> > > >> > > >> > Thanks, > >> > > >> > Greg > >> > > >> > >> Hi, > >> unfortunately is a server problem. Looking at the log FreeTDS > >> correctly send the cancel request but server does not process it in a > >> time fashion so at the end it output all results to client. The only > >> problem can raise from FreeTDS is the conversion from nvarchar(max) -> > >> ntext caused by protocol. You should try with git master version and > >> 7.2 protocol. > >> > >> Frediano > >> _______________________________________________ > >> 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 > From freddy77 at gmail.com Mon Jan 19 15:18:59 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 19 Jan 2015 20:18:59 +0000 Subject: [freetds] Adding NVARCHAR columns causes ct_cancel (ctlib) to hang In-Reply-To: References: Message-ID: Supposed to work! You can also get already prepared version (with configure) at ftp://ftp.freetds.org/pub/freetds/current. Frediano 2015-01-19 18:57 GMT+00:00 Gregory Holtorf : > I download the master version at > https://gitorious.org/freetds/freetds/source/a8bafc940508adcb575d1d72b4ff456c9973f5e4: > but that version apparently can't ./configure and make on unix (even > though) some of the readme still says to do that. Is there a version that > still works on unix? > From freddy77 at gmail.com Mon Jan 19 16:08:52 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 19 Jan 2015 21:08:52 +0000 Subject: [freetds] Next stable release In-Reply-To: <54BCE2D0.5090204@zoznam.sk> References: <54BCE2D0.5090204@zoznam.sk> Message-ID: 2015-01-19 10:56 GMT+00:00 LacaK : > Hi, > is there any plan, or time estimation for next (post 0.91) stable release of > FreeTDS ? > (as it is more than 3 years after 0.91 was released) > If not, then is current git master stable enough? > (or are there any work in progress changes?) > Thanks > -Laco. Hi, I have to say that the code state is quite in a wonderful state. Unfortunately the project state is not. James mainly left the project so I'm the only guy left. I still miss some access (for instance the snapshots work not correctly but I can't actually fix them). The code. Tests are more and run better than 0.91. There are many improvements and mssql 2008 protocol is supported. dblib can handle newer protocols (beside some small restrictions due to protocol changes). The only reasons current tests does not fully pass are not regressions (same tests would fail on 0.91) and are due to very restrictive checks. Regards, Frediano From christos at zoulas.com Mon Jan 19 17:49:39 2015 From: christos at zoulas.com (Christos Zoulas) Date: Mon, 19 Jan 2015 17:49:39 -0500 Subject: [freetds] Next stable release In-Reply-To: from Frediano Ziglio (Jan 19, 9:08pm) Message-ID: <20150119224939.380BB17FDAA@rebar.astron.com> On Jan 19, 9:08pm, freddy77 at gmail.com (Frediano Ziglio) wrote: -- Subject: Re: [freetds] Next stable release | 2015-01-19 10:56 GMT+00:00 LacaK : | > Hi, | > is there any plan, or time estimation for next (post 0.91) stable release of | > FreeTDS ? | > (as it is more than 3 years after 0.91 was released) | > If not, then is current git master stable enough? | > (or are there any work in progress changes?) | > Thanks | > -Laco. | | Hi, | I have to say that the code state is quite in a wonderful state. | Unfortunately the project state is not. James mainly left the project | so I'm the only guy left. I still miss some access (for instance the | snapshots work not correctly but I can't actually fix them). | | The code. Tests are more and run better than 0.91. There are many | improvements and mssql 2008 protocol is supported. dblib can handle | newer protocols (beside some small restrictions due to protocol | changes). The only reasons current tests does not fully pass are not | regressions (same tests would fail on 0.91) and are due to very | restrictive checks. Please let me know what you need. Jim was planning to give you access... christos From lacak at zoznam.sk Tue Jan 20 02:12:02 2015 From: lacak at zoznam.sk (LacaK) Date: Tue, 20 Jan 2015 08:12:02 +0100 Subject: [freetds] Next stable release In-Reply-To: References: <54BCE2D0.5090204@zoznam.sk> Message-ID: <54BDFFC2.6000402@zoznam.sk> Frediano Ziglio wrote / nap?sal(a): > 2015-01-19 10:56 GMT+00:00 LacaK : > >> Hi, >> is there any plan, or time estimation for next (post 0.91) stable release of >> FreeTDS ? >> (as it is more than 3 years after 0.91 was released) >> If not, then is current git master stable enough? >> (or are there any work in progress changes?) >> Thanks >> -Laco. >> > > Hi, > I have to say that the code state is quite in a wonderful state. > > Unfortunately the project state is not. James mainly left the project > so I'm the only guy left. I still miss some access (for instance the > snapshots work not correctly but I can't actually fix them). > > The code. Tests are more and run better than 0.91. There are many > improvements and mssql 2008 protocol is supported. dblib can handle > newer protocols (beside some small restrictions due to protocol > changes). The only reasons current tests does not fully pass are not > regressions (same tests would fail on 0.91) and are due to very > restrictive checks. > Okay this is good news IMO if you do not have on your To-Do list any important changes, then it is time to make new release ... Of course I understand, that may be it is not so easy prepare new release ... I noticed that there was added in dblib new struct "DBCOL2" with support in function "dbtablecolinfo" DBCOL2 has added "TypeDeclaration" DBCHAR[256] member. AFAIU this member uses "on_server.column_type" and "on_server.column_size" and formats textual representation of data type like "CHAR(20)" or "NVARCHAR(10)". It is useful, but I must parse on client side this string, when I need obtain server column data type. Would it be possible add one or two more members to DBCOL2 (f.e. ColumnType=on_server.column_type, ColumnSize=on_server.column_size) ?, which will let client distinguish between: - SYBVARCHAR and SYBCHAR (see dbcoltype) - NCHAR, NVARCHAR and CHAR What do you think about it ? -Laco. From james.k.lowden at icloud.com Mon Jan 26 21:48:28 2015 From: james.k.lowden at icloud.com (James K. Lowden) Date: Mon, 26 Jan 2015 21:48:28 -0500 Subject: [freetds] chapter next Message-ID: <20150126214828.5d253a97.james.k.lowden@icloud.com> Greetings All, I want to let everyone know just a little news about the FreeTDS project from my perspective. Frediano has agreed to be the Project Maintainer and is in the process of acquiring the requisite keys to the kingdom. It's fitting; no one has done more to make FreeTDS what it is today. I have faith that Frediano won't pull up the drawbridge, not that I mean to cross it very much. I know he's interested in fixing the overnight snapshot process, and in more frequent releases. There's quite a bit of new functionality in the current development branch that I'm sure will be welcome in a new release. It's been quite a ride. The oldest FreeTDS message in my personal archive dates from 2001, the first year of the Bush administration. In those days FreeTDS was very much a work in progress. There was only primitive BCP (no freebcp), incomplete type conversion, just the most essential functions. The most frequent error was a TDS parsing error about invalid stream state, leading immediately to exit(3). I remember an early bug report that said char-> int conversion failed to read the last character, leading to the mother of all off-by-one errors: off by one order of magnitude. I think that was the day I decided to jump in with both feet, starting with an all-to-all db-lib type conversion test. :-) Even though my name is on a lot of email messages, I don't lay claim to most of the code. Much, much more was done by Brian & company in the early days, and later by Frediano and Bill Thompson. There are many more names, most of whom are acknowledged. It truly was a collaborative effort. Many people outside the free software community -- and perhaps you, dear reader -- wonder why someone would devote his time to programming without getting paid for it. I have one answer. My answer is simple, if surprising: selfishness and unselfishness. Why does anyone pursue any hobby? For the pleasure of mastery and discovery. I knew there was this thing called "Linux" happening, and I knew from Unix that "ls" meant "dir". I knew C, and how packet-switched networks work (but not tcp/ip). And I knew enough db-lib to be dangerous. Why not try my hand at FreeTDS as a way to learn things and build on what I knew? In my first message to Brian Bruns I offered to write a user guide. At the time there was a FAQ, but anyone starting out pretty much had to join the mailing list to learn how to set things up. I didn't know what the documentation had to *say*, but I could take Brian's notes and convert them into a proper document. In the event, he chose the doc technology and wrote the first draft. I tidied up some of the wording and added to it whenever a question arose on the list. Over the years it's come to meet my goal: seldom do we see questions on the list about how to compile the code or connect to a server. I answered people's questions to further my knowledge. How to convert character sets? How to discover the server? How to test the setup? I added to the documentation and to tsql to make answering those questions easier. As time went by, the questions got knottier: why does function X crash? Why did bcp not upload the table? Besides improved logging, I went through every db-lib function -- and every published db-lib error message -- to make sure any misuse returned an error and called the error handler. Every documented message that can be produced *is* produced, somewhere in the code. Eventually I learned enough (especially from Richard Stevens) to do the very hard work of fixing the communications stack top to bottom, so that timeouts actually work as specified. In the process of answering questions and investigating problems, I learned a whale of a lot about operating systems, standards, networks, and the many sundry things Unix teaches about tooling and architecture. It is said, "It's amazing what a man can accomplish in 10 years." For myself I know that's true: When it came time to make a career move a few years ago, it was FreeTDS that underpinned the change. Thus did the fledgling fly the coop. My work nowadays doesn't involve FreeTDS or SQL Server, or very much database work. My technical interests have changed, too; having learned (I would say) what FreeTDS has to teach about clients, I've gone to the other side, to the server. More on that another time. Meanwhile, the FreeTDS project is dying on the vine. One maintainer does not a project make. Microsoft keeps moving the gateposts. Required functionality changes. Microsoft now has its own closed-source ODBC driver for (some kinds of) Linux. The open-source door to SQL Server is closing, will close without sustained effort. If you see some of your story in mine, I suggest you consider lending a hand. Only doing is knowing. You never know where it might lead. I should mention one unexpected pleasure of participating in this community: the number and kind of wonderful people I meet, many of whom I learned from and count as friends. They help me, as the old Irish prayer says, to work to change the things I can, to accept the things I can't, and to recognize the difference. Plus, they're fun to be around. Sometimes I make them laugh, too, sometimes intentionally. I'm human, and as much as anyone I'd like to be showered in leis and buried in praise, whether or not deserved. I'm glad to have played a part in bringing FreeTDS along as far as we have. I will not claim, though, that I did it all for You. I did it for me, and you happened to benefit. So thanks, and you're welcome. --jkl From msabramo at gmail.com Mon Jan 26 22:59:30 2015 From: msabramo at gmail.com (Marc Abramowitz) Date: Mon, 26 Jan 2015 19:59:30 -0800 Subject: [freetds] chapter next In-Reply-To: <20150126214828.5d253a97.james.k.lowden@icloud.com> References: <20150126214828.5d253a97.james.k.lowden@icloud.com> Message-ID: Great work, James!. It's been a pleasure learning from you. Rest assured your impact goes beyond FreeTDS to the myriad of libraries that build on top of FreeTDS, such as pymssql, the one I am most familiar with, but many others as well I'm sure. Marc From craigberry at mac.com Mon Jan 26 23:04:00 2015 From: craigberry at mac.com (Craig A. Berry) Date: Mon, 26 Jan 2015 22:04:00 -0600 Subject: [freetds] chapter next In-Reply-To: References: <20150126214828.5d253a97.james.k.lowden@icloud.com> Message-ID: <87639338-BCED-457E-B186-237FE0801CA8@mac.com> > On Jan 26, 2015, at 9:59 PM, Marc Abramowitz wrote: > > Great work, James!. It's been a pleasure learning from you. Me too. There is a clarity and precision about everything you touch, James, that has made working with FreeTDS an enlightening pleasure. Don't run off too far. You do know that all the servers these days are just clients to other servers :-). ________________________________________ Craig A. Berry mailto:craigberry at mac.com "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser From lacak at zoznam.sk Tue Jan 27 04:05:35 2015 From: lacak at zoznam.sk (LacaK) Date: Tue, 27 Jan 2015 10:05:35 +0100 Subject: [freetds] chapter next In-Reply-To: <20150126214828.5d253a97.james.k.lowden@icloud.com> References: <20150126214828.5d253a97.james.k.lowden@icloud.com> Message-ID: <54C754DF.3050901@zoznam.sk> Nice written text :-) Thank you. -Laco. > Greetings All, > > I want to let everyone know just a little news about the FreeTDS > project from my perspective. > > Frediano has agreed to be the Project Maintainer and is in the process > of acquiring the requisite keys to the kingdom. It's fitting; no one > has done more to make FreeTDS what it is today. > > I have faith that Frediano won't pull up the drawbridge, not that I mean > to cross it very much. I know he's interested in fixing the overnight > snapshot process, and in more frequent releases. There's quite a bit > of new functionality in the current development branch that I'm sure > will be welcome in a new release. > > It's been quite a ride. The oldest FreeTDS message in my personal > archive dates from 2001, the first year of the Bush administration. In > those days FreeTDS was very much a work in progress. There was only > primitive BCP (no freebcp), incomplete type conversion, just the most > essential functions. The most frequent error was a TDS parsing error > about invalid stream state, leading immediately to exit(3). > > I remember an early bug report that said char-> int conversion failed > to read the last character, leading to the mother of all off-by-one > errors: off by one order of magnitude. I think that was the day I > decided to jump in with both feet, starting with an all-to-all db-lib > type conversion test. :-) > > Even though my name is on a lot of email messages, I don't lay claim to > most of the code. Much, much more was done by Brian & company in the > early days, and later by Frediano and Bill Thompson. There are many > more names, most of whom are acknowledged. It truly was a collaborative > effort. > > Many people outside the free software community -- and perhaps you, > dear reader -- wonder why someone would devote his time to programming > without getting paid for it. I have one answer. > > My answer is simple, if surprising: selfishness and unselfishness. > > Why does anyone pursue any hobby? For the pleasure of mastery and > discovery. I knew there was this thing called "Linux" happening, and I > knew from Unix that "ls" meant "dir". I knew C, and how > packet-switched networks work (but not tcp/ip). And I knew enough > db-lib to be dangerous. Why not try my hand at FreeTDS as a way to > learn things and build on what I knew? > > In my first message to Brian Bruns I offered to write a user guide. At > the time there was a FAQ, but anyone starting out pretty much had to > join the mailing list to learn how to set things up. I didn't know > what the documentation had to *say*, but I could take Brian's notes and > convert them into a proper document. In the event, he chose the doc > technology and wrote the first draft. I tidied up some of the wording > and added to it whenever a question arose on the list. Over the years > it's come to meet my goal: seldom do we see questions on the list about > how to compile the code or connect to a server. > > I answered people's questions to further my knowledge. How to convert > character sets? How to discover the server? How to test the setup? I > added to the documentation and to tsql to make answering those questions > easier. As time went by, the questions got knottier: why does function > X crash? Why did bcp not upload the table? > > Besides improved logging, I went through every db-lib function -- and > every published db-lib error message -- to make sure any misuse > returned an error and called the error handler. Every documented > message that can be produced *is* produced, somewhere in the code. > Eventually I learned enough (especially from Richard Stevens) to do the > very hard work of fixing the communications stack top to bottom, so > that timeouts actually work as specified. > > In the process of answering questions and investigating problems, I > learned a whale of a lot about operating systems, standards, networks, > and the many sundry things Unix teaches about tooling and > architecture. It is said, "It's amazing what a man can accomplish in > 10 years." For myself I know that's true: When it came time to make a > career move a few years ago, it was FreeTDS that underpinned the > change. > > Thus did the fledgling fly the coop. > > My work nowadays doesn't involve FreeTDS or SQL Server, or very much > database work. My technical interests have changed, too; having > learned (I would say) what FreeTDS has to teach about clients, I've > gone to the other side, to the server. More on that another time. > > Meanwhile, the FreeTDS project is dying on the vine. One maintainer > does not a project make. Microsoft keeps moving the gateposts. > Required functionality changes. Microsoft now has its own > closed-source ODBC driver for (some kinds of) Linux. The open-source > door to SQL Server is closing, will close without sustained effort. If > you see some of your story in mine, I suggest you consider lending a > hand. Only doing is knowing. You never know where it might lead. > > I should mention one unexpected pleasure of participating in this > community: the number and kind of wonderful people I meet, many of > whom I learned from and count as friends. They help me, as the old > Irish prayer says, to work to change the things I can, to accept the > things I can't, and to recognize the difference. Plus, they're fun to > be around. Sometimes I make them laugh, too, sometimes intentionally. > > I'm human, and as much as anyone I'd like to be showered in leis and > buried in praise, whether or not deserved. I'm glad to have played a > part in bringing FreeTDS along as far as we have. I will not claim, > though, that I did it all for You. I did it for me, and you happened > to benefit. So thanks, and you're welcome. > > --jkl > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > From sales at minixel.com Thu Jan 29 19:36:09 2015 From: sales at minixel.com (sales at minixel.com) Date: Thu, 29 Jan 2015 17:36:09 -0700 Subject: [freetds] Compiling error on Ubuntu In-Reply-To: Message-ID: <20150129173609.634bca34b52c4f6bbfcba067e6079228.356515d492.mailapi@email01.secureserver.net> I am compiling freetds from CVS like this ./configure --prefix= --with-tdsver=8.0 --enable-msdblib --with-unixodbc=$(odbc_config --prefix) --enable-krb5 the configure command runs fine, but the make fails, as below /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/include/krb5 -I/usr/include/et -DUNIXODBC -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I//include -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -pthread -g -O2 -Wdeclaration-after-statement -MT gssapi.lo -MD -MP -MF .deps/gssapi.Tpo -c -o gssapi.lo gssapi.c libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/include/krb5 -I/usr/include/et -DUNIXODBC -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I//include -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -pthread -g -O2 -Wdeclaration-after-statement -MT gssapi.lo -MD -MP -MF .deps/gssapi.Tpo -c gssapi.c -fPIC -DPIC -o .libs/gssapi.o gssapi.c:259:1: error: conflicting types for 'error_message' error_message(OM_uint32 e) ^ In file included from gssapi.c:57:0: /usr/include/et/com_err.h:38:20: note: previous declaration of 'error_message' was here extern char const *error_message (long); ^ make[4]: *** [gssapi.lo] Error 1 make[4]: Leaving directory `/usr/src/freetds/src/tds' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/usr/src/freetds/src/tds' make[2]: *** [all] Error 2 make[2]: Leaving directory `/usr/src/freetds/src/tds' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/usr/src/freetds/src' make: *** [all-recursive] Error 1 if I do not add kerberos to the configure, it does work, Compile-time settings (established with the "configure" script) Version: freetds v0.92.dev.20150129 freetds.conf directory: /etc MS db-lib source compatibility: yes Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 5.0 iODBC: no unixodbc: yes SSPI "trusted" logins: no Kerberos: no However I cannot make unixODBC connect to MS SQL. Tsql, does connect fine. Maybe I don´t need kerberos, but, how do I troubleshoot unixodbc with freetds? I am using of course an entry in freetds.conf with tds version = 8.0 Yours Federico From freddy77 at gmail.com Fri Jan 30 04:28:09 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 30 Jan 2015 09:28:09 +0000 Subject: [freetds] Compiling error on Ubuntu In-Reply-To: <20150129173609.634bca34b52c4f6bbfcba067e6079228.356515d492.mailapi@email01.secureserver.net> References: <20150129173609.634bca34b52c4f6bbfcba067e6079228.356515d492.mailapi@email01.secureserver.net> Message-ID: 2015-01-30 0:36 GMT+00:00 : > I am compiling freetds from CVS like this > ./configure --prefix= --with-tdsver=8.0 --enable-msdblib --with-unixodbc=$(odbc_config --prefix) --enable-krb5 > the configure command runs fine, but the make fails, as below > > /bin/sh ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/include/krb5 -I/usr/include/et -DUNIXODBC -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I//include -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -pthread -g -O2 -Wdeclaration-after-statement -MT gssapi.lo -MD -MP -MF .deps/gssapi.Tpo -c -o gssapi.lo gssapi.c > libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I/usr/include/krb5 -I/usr/include/et -DUNIXODBC -DHAVE_UNISTD_H -DHAVE_PWD_H -DHAVE_SYS_TYPES_H -DHAVE_LONG_LONG -DSIZEOF_LONG_INT=8 -I//include -D_REENTRANT -D_THREAD_SAFE -DDEBUG=1 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-long-long -pthread -g -O2 -Wdeclaration-after-statement -MT gssapi.lo -MD -MP -MF .deps/gssapi.Tpo -c gssapi.c -fPIC -DPIC -o .libs/gssapi.o > gssapi.c:259:1: error: conflicting types for 'error_message' > error_message(OM_uint32 e) > ^ > In file included from gssapi.c:57:0: > /usr/include/et/com_err.h:38:20: note: previous declaration of 'error_message' was here > extern char const *error_message (long); > ^ > make[4]: *** [gssapi.lo] Error 1 > make[4]: Leaving directory `/usr/src/freetds/src/tds' > make[3]: *** [all-recursive] Error 1 > make[3]: Leaving directory `/usr/src/freetds/src/tds' > make[2]: *** [all] Error 2 > make[2]: Leaving directory `/usr/src/freetds/src/tds' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/usr/src/freetds/src' > make: *** [all-recursive] Error 1 > > if I do not add kerberos to the configure, it does work, > > Compile-time settings (established with the "configure" script) > Version: freetds v0.92.dev.20150129 > freetds.conf directory: /etc > MS db-lib source compatibility: yes > Sybase binary compatibility: no > Thread safety: yes > iconv library: yes > TDS version: 5.0 > iODBC: no > unixodbc: yes > SSPI "trusted" logins: no > Kerberos: no > > However I cannot make unixODBC connect to MS SQL. Tsql, does connect fine. Maybe I don´t need kerberos, but, how do I troubleshoot unixodbc with freetds? > I am using of course an entry in freetds.conf with > tds version = 8.0 > > Yours > Federico Hi Federico, it's a known old issue. Yesterday I just fixed snapshot creation. Could you try download again last snapshot (current on http://www.freetds.org/software.html) ? Frediano From freddy77 at gmail.com Sat Jan 31 08:49:46 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sat, 31 Jan 2015 13:49:46 +0000 Subject: [freetds] VARCHAR(max) in SP output params with TDS>=7.2 and rpc API In-Reply-To: References: Message-ID: 2014-11-23 18:31 GMT+00:00 Ramiro Morales : > Hi all, > > I've found FreeTDS master can't handle the new in TDS 7.2 ability to > handle values longer than 8000 chars. > > I've opened a merge request which adds tests that show the failure: > > https://gitorious.org/freetds/freetds/merge_requests/32 > > I tried to modify the RPC parameter handling rpc API code to get this > working by following what can be read at > http://www.freetds.org/tds.html#login7 ('Types' sub-section): > > There is a call-out in that table for the XSYBVARBINARY, XSYBVARCHAR > and XSYBNVARCHAR data types that reads: > > "* Under TDS 7.2+ these types allow size to be -1, representing > varchar(max), varbinary(max) and nvarchar(max)." > > Unfortuately my attemps were unsuccessful. I suspect what is described > there doesn't apply to the RPC SP API. > > Any hints on how these data types need to be represented on the wire > are welcome. I'd be willing to try to implement the required changes. > > Regards, > > PS: My use case is about output parameters, but it's possible input > ones also need work. See https://github.com/pymssql/pymssql/issues/275 > Hi Ramiro, I'm trying to have a look at your patch. I didn't fix the compatibility with Sybase but I did some test and I came up with some patches. One problem is that there are not strictly speaking output parameters, a parameter can be input or input/output. The trick to use NVARCHAR was to be able to insert any character into database but of course you limit to 4000 instead of 8000. I tried at first to use VARCHAR(MAX) as it has no limit, server returns it but it put these field last. Not a big deal but could break application which expect field in a given order (like our test). See https://gitorious.org/freetds/mars-freetds/commits/856eed7d1d529377db33f452204aa344c8d778ad branch, it's messy but I put some changes. Basically the rule I turned up is: if VARCHAR is up to 4000 use NVARCHAR, if not use VARCHAR. I also changed your sql script to use char/nchar function so file encoding is not an issue (it tuned out that file was utf-8 but client iso8859-1 so the single character you specified turned out to be 2 characters). You should also use SYBVARCHAR and not 231, our dblib convert every string and should not deal with wide characters. I tried to switch client to utf-8 (commented out) and characters are returned correctly but test fail for lengths returned. I'm not sure that returning twice the length is fine. Frediano From freddy77 at gmail.com Sat Jan 31 11:36:46 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sat, 31 Jan 2015 16:36:46 +0000 Subject: [freetds] Next stable release In-Reply-To: <54BDFFC2.6000402@zoznam.sk> References: <54BCE2D0.5090204@zoznam.sk> <54BDFFC2.6000402@zoznam.sk> Message-ID: 2015-01-20 7:12 GMT+00:00 LacaK : > Frediano Ziglio wrote / nap?sal(a): > >> 2015-01-19 10:56 GMT+00:00 LacaK : >> >>> >>> Hi, >>> is there any plan, or time estimation for next (post 0.91) stable release >>> of >>> FreeTDS ? >>> (as it is more than 3 years after 0.91 was released) >>> If not, then is current git master stable enough? >>> (or are there any work in progress changes?) >>> Thanks >>> -Laco. >>> >> >> >> Hi, >> I have to say that the code state is quite in a wonderful state. >> Unfortunately the project state is not. James mainly left the project >> so I'm the only guy left. I still miss some access (for instance the >> snapshots work not correctly but I can't actually fix them). >> >> The code. Tests are more and run better than 0.91. There are many >> improvements and mssql 2008 protocol is supported. dblib can handle >> newer protocols (beside some small restrictions due to protocol >> changes). The only reasons current tests does not fully pass are not >> regressions (same tests would fail on 0.91) and are due to very >> restrictive checks. >> > > Okay this is good news > IMO if you do not have on your To-Do list any important changes, then it is > time to make new release ... > Of course I understand, that may be it is not so easy prepare new release > ... > > I noticed that there was added in dblib new struct "DBCOL2" with support in > function "dbtablecolinfo" > DBCOL2 has added "TypeDeclaration" DBCHAR[256] member. > AFAIU this member uses "on_server.column_type" and "on_server.column_size" > and formats textual representation of data type like "CHAR(20)" or > "NVARCHAR(10)". > It is useful, but I must parse on client side this string, when I need > obtain server column data type. > > Would it be possible add one or two more members to DBCOL2 (f.e. > ColumnType=on_server.column_type, ColumnSize=on_server.column_size) ?, which > will let client distinguish between: > - SYBVARCHAR and SYBCHAR (see dbcoltype) > - NCHAR, NVARCHAR and CHAR > > What do you think about it ? > > -Laco. Would ServerType and ServerMaxLength suitable as name (there is already Type and MaxLength) ? Same types as the other variables. Frediano From freddy77 at gmail.com Sat Jan 31 19:16:29 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 1 Feb 2015 00:16:29 +0000 Subject: [freetds] freebcp - problems with blobs >8K In-Reply-To: <5408AF63.8020600@ncbi.nlm.nih.gov> References: <20140516174204.GG3089@ncbi.nlm.nih.gov> <5408AF63.8020600@ncbi.nlm.nih.gov> Message-ID: 2014-09-04 19:28 GMT+01:00 Constantin Vasilyev : > I'm trying this again with freshly compiled nightly snapshot of FreeTDS and > still getting errors: > >> src/apps/freebcp foo.dbo.blobs out /tmp/blobs.bcp -c -S MSSQL0 -U *** -P >> *** > > Starting copy... > *** glibc detected *** /tmp/freetds-dev.0.92.377/src/apps/.libs/lt-freebcp: > double free or corruption (!prev): 0x000000000196a5c0 *** > Segmentation fault > > Am I doing something wrong? > > > Constantin > > I think you downloaded an old version. Could you try again? We fixed the snapshot creation recently. Frediano From freddy77 at gmail.com Sun Feb 1 05:07:03 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 1 Feb 2015 10:07:03 +0000 Subject: [freetds] nvarchar(max) field in result set identified as WVARCHAR, not WLONGVARCHAR In-Reply-To: References: Message-ID: 2014-09-24 21:28 GMT+01:00 Matt Grimm : > Hi, > > When I use SQLColAttributeW(... SQL_DESC_CONCISE_TYPE ...) to ask FreeTDS > for the type of an nvarchar(max) column in my result set, it calls it a > SQL_WVARCHAR (-9). However, when I ask it for the type of an ntext field, > it calls it a SQL_WLONGVARCHAR. Since nvarchar(max) is the replacement for > ntext[1], shouldn't FreeTDS return -10 as the type of nvarchar(max) too? > > Thanks, > m. > Hi, probably it should but actually is the same reply I get from MS ODBC. Frediano From lacak at zoznam.sk Mon Feb 2 08:30:37 2015 From: lacak at zoznam.sk (LacaK) Date: Mon, 02 Feb 2015 14:30:37 +0100 Subject: [freetds] Next stable release In-Reply-To: References: <54BCE2D0.5090204@zoznam.sk> <54BDFFC2.6000402@zoznam.sk> Message-ID: <54CF7BFD.2030004@zoznam.sk> D?a 31.1.2015 o 17:36 Frediano Ziglio nap?sal(a): > 2015-01-20 7:12 GMT+00:00 LacaK : >> Frediano Ziglio wrote / nap?sal(a): >> >>> 2015-01-19 10:56 GMT+00:00 LacaK : >>> >>>> Hi, >>>> is there any plan, or time estimation for next (post 0.91) stable release >>>> of >>>> FreeTDS ? >>>> (as it is more than 3 years after 0.91 was released) >>>> If not, then is current git master stable enough? >>>> (or are there any work in progress changes?) >>>> Thanks >>>> -Laco. >>>> >>> >>> Hi, >>> I have to say that the code state is quite in a wonderful state. >>> Unfortunately the project state is not. James mainly left the project >>> so I'm the only guy left. I still miss some access (for instance the >>> snapshots work not correctly but I can't actually fix them). >>> >>> The code. Tests are more and run better than 0.91. There are many >>> improvements and mssql 2008 protocol is supported. dblib can handle >>> newer protocols (beside some small restrictions due to protocol >>> changes). The only reasons current tests does not fully pass are not >>> regressions (same tests would fail on 0.91) and are due to very >>> restrictive checks. >>> >> Okay this is good news >> IMO if you do not have on your To-Do list any important changes, then it is >> time to make new release ... >> Of course I understand, that may be it is not so easy prepare new release >> ... >> >> I noticed that there was added in dblib new struct "DBCOL2" with support in >> function "dbtablecolinfo" >> DBCOL2 has added "TypeDeclaration" DBCHAR[256] member. >> AFAIU this member uses "on_server.column_type" and "on_server.column_size" >> and formats textual representation of data type like "CHAR(20)" or >> "NVARCHAR(10)". >> It is useful, but I must parse on client side this string, when I need >> obtain server column data type. >> >> Would it be possible add one or two more members to DBCOL2 (f.e. >> ColumnType=on_server.column_type, ColumnSize=on_server.column_size) ?, which >> will let client distinguish between: >> - SYBVARCHAR and SYBCHAR (see dbcoltype) >> - NCHAR, NVARCHAR and CHAR >> >> What do you think about it ? >> >> -Laco. > Would ServerType and ServerMaxLength suitable as name (there is > already Type and MaxLength) ? Same types as the other variables. Of course. I agree. But then new "TypeDeclaration" (already added to DBCOL2) is bit inconsistent in naming. It should be then "ServerTypeDeclaration" or something with prefix "Server" also, IMO. Thanks -Laco. From freddy77 at gmail.com Tue Feb 3 12:21:07 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 3 Feb 2015 17:21:07 +0000 Subject: [freetds] Next stable release In-Reply-To: <54CF7BFD.2030004@zoznam.sk> References: <54BCE2D0.5090204@zoznam.sk> <54BDFFC2.6000402@zoznam.sk> <54CF7BFD.2030004@zoznam.sk> Message-ID: 2015-02-02 13:30 GMT+00:00 LacaK : > D?a 31.1.2015 o 17:36 Frediano Ziglio nap?sal(a): > >> 2015-01-20 7:12 GMT+00:00 LacaK : >>> >>> Frediano Ziglio wrote / nap?sal(a): >>> >>>> 2015-01-19 10:56 GMT+00:00 LacaK : >>>> >>>>> Hi, >>>>> is there any plan, or time estimation for next (post 0.91) stable >>>>> release >>>>> of >>>>> FreeTDS ? >>>>> (as it is more than 3 years after 0.91 was released) >>>>> If not, then is current git master stable enough? >>>>> (or are there any work in progress changes?) >>>>> Thanks >>>>> -Laco. >>>>> >>>> >>>> Hi, >>>> I have to say that the code state is quite in a wonderful state. >>>> Unfortunately the project state is not. James mainly left the project >>>> so I'm the only guy left. I still miss some access (for instance the >>>> snapshots work not correctly but I can't actually fix them). >>>> >>>> The code. Tests are more and run better than 0.91. There are many >>>> improvements and mssql 2008 protocol is supported. dblib can handle >>>> newer protocols (beside some small restrictions due to protocol >>>> changes). The only reasons current tests does not fully pass are not >>>> regressions (same tests would fail on 0.91) and are due to very >>>> restrictive checks. >>>> >>> Okay this is good news >>> IMO if you do not have on your To-Do list any important changes, then it >>> is >>> time to make new release ... >>> Of course I understand, that may be it is not so easy prepare new release >>> ... >>> >>> I noticed that there was added in dblib new struct "DBCOL2" with support >>> in >>> function "dbtablecolinfo" >>> DBCOL2 has added "TypeDeclaration" DBCHAR[256] member. >>> AFAIU this member uses "on_server.column_type" and >>> "on_server.column_size" >>> and formats textual representation of data type like "CHAR(20)" or >>> "NVARCHAR(10)". >>> It is useful, but I must parse on client side this string, when I need >>> obtain server column data type. >>> >>> Would it be possible add one or two more members to DBCOL2 (f.e. >>> ColumnType=on_server.column_type, ColumnSize=on_server.column_size) ?, >>> which >>> will let client distinguish between: >>> - SYBVARCHAR and SYBCHAR (see dbcoltype) >>> - NCHAR, NVARCHAR and CHAR >>> >>> What do you think about it ? >>> >>> -Laco. >> >> Would ServerType and ServerMaxLength suitable as name (there is >> already Type and MaxLength) ? Same types as the other variables. > > > Of course. I agree. > > But then new "TypeDeclaration" (already added to DBCOL2) is bit inconsistent > in naming. > It should be then "ServerTypeDeclaration" or something with prefix "Server" > also, IMO. > > Thanks > > -Laco. > Done, https://gitorious.org/freetds/freetds/commit/d249416fcd9af5294841930d4aa68bfe5ef7987e Frediano From geoff.montee at gmail.com Tue Feb 3 16:33:03 2015 From: geoff.montee at gmail.com (Geoff Montee) Date: Tue, 3 Feb 2015 16:33:03 -0500 Subject: [freetds] Problems on CentOS 7 connecting to MS SQL Server with ODBC and SQLDriverConnect Message-ID: There's quite a bit of background to this problem that can be found here: https://mariadb.atlassian.net/browse/MDEV-7508 But to keep the problem description specific to this audience, I've been having trouble connecting to MS SQL Server on CentOS 7 with unixODBC and FreeTDS using the SQLDriverConnect function, while connecting with the SQLConnect function works just fine. I'm wondering if this is a bug in either the version of FreeTDS included in the CentOS 7 EPEL or the version of unixODBC included in the main CentOS 7 repository. The versions of the libraries involved are: [gmontee at localhost ~]$ sudo yum list unixODBC* Installed Packages unixODBC.x86_64 2.3.1-10.el7 @anaconda [gmontee at localhost ~]$ sudo yum list freetds* Installed Packages freetds.x86_64 0.91-12.git0a42888.el7 @epel This problem can be demonstrated by: - Successfully connecting to MS SQL Server with isql's default connection method, which uses SQLConnect. - Failing to connect to MS SQL Server by passing isql the -k flag, which uses SQLDriverConnect. e.g.: [gmontee at localhost ~]$ isql -v -k connect_test_azure connect_test 'Password1' [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified [ISQL]ERROR: Could not SQLDriverConnect [gmontee at localhost ~]$ isql -v connect_test_azure connect_test 'Password1' +---------------------------------------+ | Connected! | | | | sql-statement | | help [tablename] | | quit | | | +---------------------------------------+ SQL> quit [gmontee at localhost ~]$ isql -v -k connect_test_azure connect_test 'Password1' [IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified [ISQL]ERROR: Could not SQLDriverConnect The error doesn't make sense, since the data source is obviously valid. The ODBC trace doesn't provide much useful information (for me): [ODBC][5402][1422997746.674955][__handles.c][460] Exit:[SQL_SUCCESS] Environment = 0x71d750 [ODBC][5402][1422997746.675748][SQLAllocHandle.c][375] Entry: Handle Type = 2 Input Handle = 0x71d750 [ODBC][5402][1422997746.675790][SQLAllocHandle.c][493] Exit:[SQL_SUCCESS] Output Handle = 0x71e050 [ODBC][5402][1422997746.675820][SQLDriverConnect.c][726] Entry: Connection = 0x71e050 Window Hdl = (nil) Str In = [connect_test_azure][length = 18 (SQL_NTS)] Str Out = 0x7fff68c90490 Str Out Max = 2048 Str Out Ptr = (nil) Completion = 0 [ODBC][5402][1422997746.675843][SQLDriverConnect.c][1136]Error: IM002 [ODBC][5402][1422997746.675882][SQLFreeHandle.c][284] Entry: Handle Type = 2 Input Handle = 0x71e050 [ODBC][5402][1422997746.675907][SQLFreeHandle.c][333] Exit:[SQL_SUCCESS] [ODBC][5402][1422997746.675928][SQLFreeHandle.c][219] Entry: Handle Type = 1 Input Handle = 0x71d750 I've primarily been using a ODBC-only configuration. e.g.: cat > tds.driver.template < tds.datasource.template < References: <54BCE2D0.5090204@zoznam.sk> <54BDFFC2.6000402@zoznam.sk> <54CF7BFD.2030004@zoznam.sk> Message-ID: <54D1B82E.2000003@zoznam.sk> D?a 3.2.2015 o 18:21 Frediano Ziglio nap?sal(a): > 2015-02-02 13:30 GMT+00:00 LacaK : >> D?a 31.1.2015 o 17:36 Frediano Ziglio nap?sal(a): >> >>> 2015-01-20 7:12 GMT+00:00 LacaK : >>>> Frediano Ziglio wrote / nap?sal(a): >>>> >>>>> 2015-01-19 10:56 GMT+00:00 LacaK : >>>>> >>>>>> Hi, >>>>>> is there any plan, or time estimation for next (post 0.91) stable >>>>>> release >>>>>> of >>>>>> FreeTDS ? >>>>>> (as it is more than 3 years after 0.91 was released) >>>>>> If not, then is current git master stable enough? >>>>>> (or are there any work in progress changes?) >>>>>> Thanks >>>>>> -Laco. >>>>>> >>>>> Hi, >>>>> I have to say that the code state is quite in a wonderful state. >>>>> Unfortunately the project state is not. James mainly left the project >>>>> so I'm the only guy left. I still miss some access (for instance the >>>>> snapshots work not correctly but I can't actually fix them). >>>>> >>>>> The code. Tests are more and run better than 0.91. There are many >>>>> improvements and mssql 2008 protocol is supported. dblib can handle >>>>> newer protocols (beside some small restrictions due to protocol >>>>> changes). The only reasons current tests does not fully pass are not >>>>> regressions (same tests would fail on 0.91) and are due to very >>>>> restrictive checks. >>>>> >>>> Okay this is good news >>>> IMO if you do not have on your To-Do list any important changes, then it >>>> is >>>> time to make new release ... >>>> Of course I understand, that may be it is not so easy prepare new release >>>> ... >>>> >>>> I noticed that there was added in dblib new struct "DBCOL2" with support >>>> in >>>> function "dbtablecolinfo" >>>> DBCOL2 has added "TypeDeclaration" DBCHAR[256] member. >>>> AFAIU this member uses "on_server.column_type" and >>>> "on_server.column_size" >>>> and formats textual representation of data type like "CHAR(20)" or >>>> "NVARCHAR(10)". >>>> It is useful, but I must parse on client side this string, when I need >>>> obtain server column data type. >>>> >>>> Would it be possible add one or two more members to DBCOL2 (f.e. >>>> ColumnType=on_server.column_type, ColumnSize=on_server.column_size) ?, >>>> which >>>> will let client distinguish between: >>>> - SYBVARCHAR and SYBCHAR (see dbcoltype) >>>> - NCHAR, NVARCHAR and CHAR >>>> >>>> What do you think about it ? >>>> >>>> -Laco. >>> Would ServerType and ServerMaxLength suitable as name (there is >>> already Type and MaxLength) ? Same types as the other variables. >> >> Of course. I agree. >> >> But then new "TypeDeclaration" (already added to DBCOL2) is bit inconsistent >> in naming. >> It should be then "ServerTypeDeclaration" or something with prefix "Server" >> also, IMO. >> >> Thanks >> >> -Laco. >> > Done, > https://gitorious.org/freetds/freetds/commit/d249416fcd9af5294841930d4aa68bfe5ef7987e Excellent. Thanks -Laco. From freddy77 at gmail.com Wed Feb 4 04:42:43 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Wed, 4 Feb 2015 09:42:43 +0000 Subject: [freetds] Problems on CentOS 7 connecting to MS SQL Server with ODBC and SQLDriverConnect In-Reply-To: References: Message-ID: 2015-02-03 21:33 GMT+00:00 Geoff Montee : > There's quite a bit of background to this problem that can be found here: > > https://mariadb.atlassian.net/browse/MDEV-7508 > > But to keep the problem description specific to this audience, I've > been having trouble connecting to MS SQL Server on CentOS 7 with > unixODBC and FreeTDS using the SQLDriverConnect function, while > connecting with the SQLConnect function works just fine. > > I'm wondering if this is a bug in either the version of FreeTDS > included in the CentOS 7 EPEL or the version of unixODBC included in > the main CentOS 7 repository. > > The versions of the libraries involved are: > > [gmontee at localhost ~]$ sudo yum list unixODBC* > Installed Packages > unixODBC.x86_64 > > 2.3.1-10.el7 > @anaconda > [gmontee at localhost ~]$ sudo yum list freetds* > Installed Packages > freetds.x86_64 > > 0.91-12.git0a42888.el7 > @epel > > This problem can be demonstrated by: > > - Successfully connecting to MS SQL Server with isql's default > connection method, which uses SQLConnect. > - Failing to connect to MS SQL Server by passing isql the -k flag, > which uses SQLDriverConnect. > > e.g.: > > [gmontee at localhost ~]$ isql -v -k connect_test_azure connect_test 'Password1' With -k you have to pass a connection string, not only a DSN value, so something like isql -v -k 'DSN=connect_test_azure;UID=user;PWD=password;' > [IM002][unixODBC][Driver Manager]Data source name not found, and no > default driver specified The error came from the DM (Driver Manager) so unixODBC didn't even load FreeTDS. > [ISQL]ERROR: Could not SQLDriverConnect > [gmontee at localhost ~]$ isql -v connect_test_azure connect_test 'Password1' > +---------------------------------------+ > | Connected! | > | | > | sql-statement | > | help [tablename] | > | quit | > | | > +---------------------------------------+ > SQL> quit > [gmontee at localhost ~]$ isql -v -k connect_test_azure connect_test 'Password1' > [IM002][unixODBC][Driver Manager]Data source name not found, and no > default driver specified > [ISQL]ERROR: Could not SQLDriverConnect > > The error doesn't make sense, since the data source is obviously valid. > > The ODBC trace doesn't provide much useful information (for me): > > [ODBC][5402][1422997746.674955][__handles.c][460] > Exit:[SQL_SUCCESS] > Environment = 0x71d750 > [ODBC][5402][1422997746.675748][SQLAllocHandle.c][375] > Entry: > Handle Type = 2 > Input Handle = 0x71d750 > [ODBC][5402][1422997746.675790][SQLAllocHandle.c][493] > Exit:[SQL_SUCCESS] > Output Handle = 0x71e050 > [ODBC][5402][1422997746.675820][SQLDriverConnect.c][726] > Entry: > Connection = 0x71e050 > Window Hdl = (nil) > Str In = [connect_test_azure][length = 18 (SQL_NTS)] > Str Out = 0x7fff68c90490 > Str Out Max = 2048 > Str Out Ptr = (nil) > Completion = 0 As you can see connection string is passed from command line verbatim. > [ODBC][5402][1422997746.675843][SQLDriverConnect.c][1136]Error: IM002 > [ODBC][5402][1422997746.675882][SQLFreeHandle.c][284] > Entry: > Handle Type = 2 > Input Handle = 0x71e050 > [ODBC][5402][1422997746.675907][SQLFreeHandle.c][333] > Exit:[SQL_SUCCESS] > [ODBC][5402][1422997746.675928][SQLFreeHandle.c][219] > Entry: > Handle Type = 1 > Input Handle = 0x71d750 > > I've primarily been using a ODBC-only configuration. > > e.g.: > > cat > tds.driver.template < [FreeTDS] > Description = ODBC for TDS protocol > Driver = /usr/lib64/libtdsodbc.so > EOM > cat > tds.datasource.template < [connect_test_azure] > Driver = FreeTDS > Description = MSSQL Server > Trace = No > Server = hostname.com > Database = connect_test > Port = 1433 > TDS_Version = 7.1 > EOM > sudo odbcinst -i -d -f tds.driver.template > sudo odbcinst -i -s -l -f tds.datasource.template > Looks ok > > Could this be a bug? Is this more appropriate for the unixODBC folks? > > Thanks, > > Geoff Montee Seems from the bug report link you provided that you solved the problem Frediano From geoff.montee at gmail.com Wed Feb 4 10:12:42 2015 From: geoff.montee at gmail.com (Geoff Montee) Date: Wed, 4 Feb 2015 10:12:42 -0500 Subject: [freetds] Problems on CentOS 7 connecting to MS SQL Server with ODBC and SQLDriverConnect In-Reply-To: References: Message-ID: Hi Frediano, On Wed, Feb 4, 2015 at 4:42 AM, Frediano Ziglio wrote: > > With -k you have to pass a connection string, not only a DSN value, so > something like > > isql -v -k 'DSN=connect_test_azure;UID=user;PWD=password;' > Oh, you're right. Passing a connection string, rather than just a DSN, did allow "isql -k" to connect. >> [IM002][unixODBC][Driver Manager]Data source name not found, and no >> default driver specified > > The error came from the DM (Driver Manager) so unixODBC didn't even > load FreeTDS. > Now that I know "isql -k" requires a connection string, rather than a DSN, this makes sense. However, I get a FreeTDS-related error when connecting with the CONNECT engine (see below) using the exact same connection string. > Seems from the bug report link you provided that you solved the problem > The problem hasn't been solved for CentOS 7 yet. A future release of the CONNECT engine will offer the option to use SQLConnect instead of SQLDriverConnect. However, I'm still wondering if there's something I can do to make the current version work with CentOS 7. Everything works fine on some platforms, such as Ubuntu 14.04. Your information regarding "isql -k" enabled me to collect some more information. This is the ODBC trace when SQLDriverConnect fails (with the CONNECT engine): [ODBC][2443][1423062226.652619][__handles.c][460] Exit:[SQL_SUCCESS] Environment = 0x7f14bda89a00 [ODBC][2443][1423062226.652765][SQLAllocHandle.c][375] Entry: Handle Type = 2 Input Handle = 0x7f14bda89a00 [ODBC][2443][1423062226.652818][SQLAllocHandle.c][493] Exit:[SQL_SUCCESS] Output Handle = 0x7f14c4321000 [ODBC][2443][1423062226.652855][SQLSetConnectOption.c][345] Entry: Connection = 0x7f14c4321000 Option = SQL_ATTR_LOGIN_TIMEOUT Value = 15 [ODBC][2443][1423062226.652889][SQLSetConnectOption.c][508] Exit:[SQL_SUCCESS] [ODBC][2443][1423062226.652922][SQLSetConnectOption.c][345] Entry: Connection = 0x7f14c4321000 Option = SQL_ATTR_ACCESS_MODE Value = 1 [ODBC][2443][1423062226.652954][SQLSetConnectOption.c][508] Exit:[SQL_SUCCESS] [ODBC][2443][1423062226.652997][SQLDriverConnect.c][726] Entry: Connection = 0x7f14c4321000 Window Hdl = 0x1 Str In = [DSN=connect_test_azure;UID=connect_test;PWD=*********;][length = 54 (SQL_NTS)] Str Out = 0x7f14a9800448 Str Out Max = 512 Str Out Ptr = 0x7f14d98fba50 Completion = 0 UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE' DIAG [08S01] [FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist DIAG [S1000] [FreeTDS][SQL Server]Unable to connect to data source [ODBC][2443][1423062226.747652][SQLDriverConnect.c][1353] Exit:[SQL_ERROR] [ODBC][2443][1423062226.747782][SQLError.c][434] Entry: Connection = 0x7f14c4321000 SQLState = 0x7f14d98fb7a0 Native = 0x7f14d98fb790 Message Text = 0x7f14d98fb7b0 Buffer Length = 511 Text Len Ptr = 0x7f14d98fb780 [ODBC][2443][1423062226.747811][SQLError.c][471] Exit:[SQL_SUCCESS] SQLState = S1000 Native = 0x7f14d98fb790 -> 0 Message Text = [[unixODBC][FreeTDS][SQL Server]Unable to connect to data source] This is the ODBC trace when SQLDriverConnect succeeds (with "isql -k" and the connection string): [ODBC][17148][1423061462.682044][__handles.c][460] Exit:[SQL_SUCCESS] Environment = 0x1ff2750 [ODBC][17148][1423061462.682135][SQLAllocHandle.c][375] Entry: Handle Type = 2 Input Handle = 0x1ff2750 [ODBC][17148][1423061462.682162][SQLAllocHandle.c][493] Exit:[SQL_SUCCESS] Output Handle = 0x1ff3050 [ODBC][17148][1423061462.682190][SQLDriverConnect.c][726] Entry: Connection = 0x1ff3050 Window Hdl = (nil) Str In = [DSN=connect_test_azure;UID=connect_test;PWD=*********;][length = 54 (SQL_NTS)] Str Out = 0x7fffd6a5f070 Str Out Max = 2048 Str Out Ptr = (nil) Completion = 0 UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE' [ODBC][17148][1423061462.877878][SQLDriverConnect.c][1582] Exit:[SQL_SUCCESS] Connection Out [[DSN=connect_test_azure;UID=connect_test;PWD=*********;][length = 54 (SQL_NTS)]] As far as I can see, the main difference is that the CONNECT engine sets a couple of options (SQL_ATTR_LOGIN_TIMEOUT, SQL_ATTR_ACCESS_MODE) before attempting to connect. Do you know if these options can cause problems with some versions of FreeTDS, but not others? As mentioned above, the CONNECT engine fails to connect with CentOS 7, but connects just fine on Ubuntu 14.04. Thanks for your reply! Geoff From freddy77 at gmail.com Wed Feb 4 18:02:22 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Wed, 4 Feb 2015 23:02:22 +0000 Subject: [freetds] Problems on CentOS 7 connecting to MS SQL Server with ODBC and SQLDriverConnect In-Reply-To: References: Message-ID: 2015-02-04 15:12 GMT+00:00 Geoff Montee : > Hi Frediano, > > On Wed, Feb 4, 2015 at 4:42 AM, Frediano Ziglio wrote: >> >> With -k you have to pass a connection string, not only a DSN value, so >> something like >> >> isql -v -k 'DSN=connect_test_azure;UID=user;PWD=password;' >> > > Oh, you're right. Passing a connection string, rather than just a DSN, > did allow "isql -k" to connect. > Did you try isql from mysql account? Could be something related to some permissions or restrictions like SELinux. >>> [IM002][unixODBC][Driver Manager]Data source name not found, and no >>> default driver specified >> >> The error came from the DM (Driver Manager) so unixODBC didn't even >> load FreeTDS. >> > > Now that I know "isql -k" requires a connection string, rather than a > DSN, this makes sense. However, I get a FreeTDS-related error when > connecting with the CONNECT engine (see below) using the exact same > connection string. > >> Seems from the bug report link you provided that you solved the problem >> > > The problem hasn't been solved for CentOS 7 yet. A future release of > the CONNECT engine will offer the option to use SQLConnect instead of > SQLDriverConnect. However, I'm still wondering if there's something I > can do to make the current version work with CentOS 7. > > Everything works fine on some platforms, such as Ubuntu 14.04. > > Your information regarding "isql -k" enabled me to collect some more > information. > > This is the ODBC trace when SQLDriverConnect fails (with the CONNECT engine): > > [ODBC][2443][1423062226.652619][__handles.c][460] > Exit:[SQL_SUCCESS] > Environment = 0x7f14bda89a00 > [ODBC][2443][1423062226.652765][SQLAllocHandle.c][375] > Entry: > Handle Type = 2 > Input Handle = 0x7f14bda89a00 > [ODBC][2443][1423062226.652818][SQLAllocHandle.c][493] > Exit:[SQL_SUCCESS] > Output Handle = 0x7f14c4321000 > [ODBC][2443][1423062226.652855][SQLSetConnectOption.c][345] > Entry: > Connection = 0x7f14c4321000 > Option = SQL_ATTR_LOGIN_TIMEOUT > Value = 15 > [ODBC][2443][1423062226.652889][SQLSetConnectOption.c][508] > Exit:[SQL_SUCCESS] > [ODBC][2443][1423062226.652922][SQLSetConnectOption.c][345] > Entry: > Connection = 0x7f14c4321000 > Option = SQL_ATTR_ACCESS_MODE > Value = 1 > [ODBC][2443][1423062226.652954][SQLSetConnectOption.c][508] > Exit:[SQL_SUCCESS] > [ODBC][2443][1423062226.652997][SQLDriverConnect.c][726] > Entry: > Connection = 0x7f14c4321000 > Window Hdl = 0x1 > Str In = > [DSN=connect_test_azure;UID=connect_test;PWD=*********;][length = 54 > (SQL_NTS)] > Str Out = 0x7f14a9800448 > Str Out Max = 512 > Str Out Ptr = 0x7f14d98fba50 > Completion = 0 > UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE' > > DIAG [08S01] [FreeTDS][SQL Server]Unable to connect: > Adaptive Server is unavailable or does not exist > > DIAG [S1000] [FreeTDS][SQL Server]Unable to connect to > data source > Unfortunately SQLDriverConnect (our implementation) is not much helpful here, mostly connection errors report the same message. > [ODBC][2443][1423062226.747652][SQLDriverConnect.c][1353] > Exit:[SQL_ERROR] > [ODBC][2443][1423062226.747782][SQLError.c][434] > Entry: > Connection = 0x7f14c4321000 > SQLState = 0x7f14d98fb7a0 > Native = 0x7f14d98fb790 > Message Text = 0x7f14d98fb7b0 > Buffer Length = 511 > Text Len Ptr = 0x7f14d98fb780 > [ODBC][2443][1423062226.747811][SQLError.c][471] > Exit:[SQL_SUCCESS] > SQLState = S1000 > Native = 0x7f14d98fb790 -> 0 > Message Text = [[unixODBC][FreeTDS][SQL > Server]Unable to connect to data source] > > > This is the ODBC trace when SQLDriverConnect succeeds (with "isql -k" > and the connection string): > > [ODBC][17148][1423061462.682044][__handles.c][460] > Exit:[SQL_SUCCESS] > Environment = 0x1ff2750 > [ODBC][17148][1423061462.682135][SQLAllocHandle.c][375] > Entry: > Handle Type = 2 > Input Handle = 0x1ff2750 > [ODBC][17148][1423061462.682162][SQLAllocHandle.c][493] > Exit:[SQL_SUCCESS] > Output Handle = 0x1ff3050 > [ODBC][17148][1423061462.682190][SQLDriverConnect.c][726] > Entry: > Connection = 0x1ff3050 > Window Hdl = (nil) > Str In = > [DSN=connect_test_azure;UID=connect_test;PWD=*********;][length = 54 > (SQL_NTS)] > Str Out = 0x7fffd6a5f070 > Str Out Max = 2048 > Str Out Ptr = (nil) > Completion = 0 > UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE' > > [ODBC][17148][1423061462.877878][SQLDriverConnect.c][1582] > Exit:[SQL_SUCCESS] > Connection Out > [[DSN=connect_test_azure;UID=connect_test;PWD=*********;][length = 54 > (SQL_NTS)]] > > > As far as I can see, the main difference is that the CONNECT engine > sets a couple of options (SQL_ATTR_LOGIN_TIMEOUT, > SQL_ATTR_ACCESS_MODE) before attempting to connect. Do you know if > these options can cause problems with some versions of FreeTDS, but > not others? As mentioned above, the CONNECT engine fails to connect > with CentOS 7, but connects just fine on Ubuntu 14.04. > I don't think these parameters are the problem. The second is not used, first just set a timeout to 15 seconds (quite long). You could also try a dsn-less connection with http://www.freetds.org/userguide/dsnless.htm. > Thanks for your reply! > > Geoff Frediano From geoff.montee at gmail.com Wed Feb 4 19:05:42 2015 From: geoff.montee at gmail.com (Geoff Montee) Date: Wed, 4 Feb 2015 19:05:42 -0500 Subject: [freetds] Problems on CentOS 7 connecting to MS SQL Server with ODBC and SQLDriverConnect In-Reply-To: References: Message-ID: On Wed, Feb 4, 2015 at 6:02 PM, Frediano Ziglio wrote: > > Did you try isql from mysql account? Could be something related to > some permissions or restrictions like SELinux. > Yeah, I tried isql as the mysql user. This worked just fine: sudo -u mysql isql connect_test_azure UID PWD That suggests to me that the mysql user can read all of the configuration files no problem. Since you mentioned SELinux, I just now set it to permissive mode, and now the CONNECT engine can connect to the data source with no issues. I guess SELinux doesn't want /usr/sbin/mysqld to make outgoing TCP connections. /var/log/messages shows: Feb 4 18:56:17 localhost python: SELinux is preventing /usr/sbin/mysqld from name_connect access on the tcp_socket . ***** Plugin catchall_boolean (89.3 confidence) suggests ****************** If you want to allow mysql to connect any Then you must tell SELinux about this by enabling the 'mysql_connect_any' boolean. You can read 'None' man page for more details. Do setsebool -P mysql_connect_any 1 ***** Plugin catchall (11.6 confidence) suggests ************************** If you believe that mysqld should be allowed name_connect access on the tcp_socket by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # grep mysqld /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp Thanks for the help! Geoff From freddy77 at gmail.com Thu Feb 5 15:33:22 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Thu, 5 Feb 2015 20:33:22 +0000 Subject: [freetds] Snapshot is now working !! Message-ID: Hi, a couple of days ago I fixed the snapshot generation. In particular userguide and reference are now generated. Also freetds-current* files point to the right versions so from the website you can just download the "Current Snapshot" (http://www.freetds.org/software.html). I'm now trying to collect things to do before a possible release. Regards, Frediano From ganoopluslinux at gmail.com Thu Feb 5 16:49:49 2015 From: ganoopluslinux at gmail.com (James Fisher) Date: Thu, 5 Feb 2015 15:49:49 -0600 Subject: [freetds] Snapshot is now working !! In-Reply-To: References: Message-ID: >I'm now trying to collect things to do before a possible release. Like a proper logout for ASA to eliminate the ''Connection terminated abnormally" errors? :D :D :D Topic here: http://article.gmane.org/gmane.comp.db.tds.freetds/15678/ On Thu, Feb 5, 2015 at 2:33 PM, Frediano Ziglio wrote: > Hi, > a couple of days ago I fixed the snapshot generation. In particular > userguide and reference are now generated. Also freetds-current* files > point to the right versions so from the website you can just download > the "Current Snapshot" (http://www.freetds.org/software.html). > > I'm now trying to collect things to do before a possible release. > > Regards, > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > From lacak at zoznam.sk Fri Feb 6 08:30:48 2015 From: lacak at zoznam.sk (LacaK) Date: Fri, 06 Feb 2015 14:30:48 +0100 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending Message-ID: <54D4C208.4020202@zoznam.sk> Hi, I have program which uses FreeTDS db-lib.dll Now I have changed TDS version from 7.1 to 7.3 and I start receiving "Attempt to initiate a new Adaptive Server operation with results pending" in some places. For example, when I send this two commands: "IF @@TRANCOUNT>0 ROLLBACK" followed by: "BEGIN TRANSACTION" I get above mentioned error. I attach portion of logs for 7.1 and 7.3 version. As you can see in both cases is returned : more_results = 1 after "IF @@TRANCOUNT>0 ROLLBACK" (I do not understand why?) But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ? Can you give me some explanation what is going on ? Thanks -Laco. -------------- next part -------------- dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) dblib.c:1333:dbcmd(04D59AB8, IF @@TRANCOUNT>0 ROLLBACK) dblib.c:1339:dbcmd() bufsz = 17 dblib.c:5833:dbfreebuf(04D59AB8) dblib.c:1387:dbsqlexec(04D59AB8) dblib.c:6807:dbsqlsend(04D59AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 3a 00 00 01 00-49 00 46 00 20 00 40 00 |...:.... I.F. . at .| 0010 40 00 54 00 52 00 41 00-4e 00 43 00 4f 00 55 00 |@.T.R.A. N.C.O.U.| 0020 4e 00 54 00 3e 00 30 00-20 00 52 00 4f 00 4c 00 |N.T.>.0. .R.O.L.| 0030 4c 00 42 00 41 00 43 00-4b 00 |L.B.A.C. K.| dblib.c:4613:dbsqlok(04D59AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04D5A310, 0166F22C, 0166F23C, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 1a 00 3c 01 00-fd 01 00 c0 00 00 00 00 |.....<.. ........| 0010 00 fd 00 00 d2 00 00 00-00 00 |........ ..| token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04D59AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:1333:dbcmd(04D59AB8, BEGIN TRANSACTION) dblib.c:1339:dbcmd() bufsz = 26 dblib.c:5833:dbfreebuf(04D59AB8) dblib.c:1387:dbsqlexec(04D59AB8) dblib.c:6807:dbsqlsend(04D59AB8) token.c:549:tds_process_tokens(04D5A310, 0166F0C8, 00000000, 0x2282a) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 token.c:2038:tds_process_end() state set to TDS_IDLE util.c:146:Changed query state from READING to IDLE mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet -------------- next part -------------- dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) dblib.c:1333:dbcmd(04DE9AB8, IF @@TRANCOUNT>0 ROLLBACK) dblib.c:1339:dbcmd() bufsz = 17 dblib.c:5833:dbfreebuf(04DE9AB8) dblib.c:1387:dbsqlexec(04DE9AB8) dblib.c:6807:dbsqlsend(04DE9AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 50 00 00 01 00-16 00 00 00 12 00 00 00 |...P.... ........| 0010 02 00 01 00 00 00 37 00-00 00 01 00 00 00 49 00 |......7. ......I.| 0020 46 00 20 00 40 00 40 00-54 00 52 00 41 00 4e 00 |F. . at .@. T.R.A.N.| 0030 43 00 4f 00 55 00 4e 00-54 00 3e 00 30 00 20 00 |C.O.U.N. T.>.0. .| 0040 52 00 4f 00 4c 00 4c 00-42 00 41 00 43 00 4b 00 |R.O.L.L. B.A.C.K.| dblib.c:4613:dbsqlok(04DE9AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04DEA310, 0166F22C, 0166F23C, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 30 00 37 01 00-fd 01 00 c0 00 00 00 00 |...0.7.. ........| 0010 00 00 00 00 00 e3 0b 00-0a 00 08 01 00 00 00 37 |........ .......7| 0020 00 00 00 fd 00 00 d2 00-00 00 00 00 00 00 00 00 |........ ........| token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04DE9AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:1333:dbcmd(04DE9AB8, BEGIN TRANSACTION) dblib.c:1339:dbcmd() bufsz = 26 dblib.c:5833:dbfreebuf(04DE9AB8) dblib.c:1387:dbsqlexec(04DE9AB8) dblib.c:6807:dbsqlsend(04DE9AB8) token.c:549:tds_process_tokens(04DEA310, 0166F0C8, 00000000, 0x2282a) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:830:tds_process_tokens::SET_RETURN stopping on current token util.c:146:Changed query state from READING to PENDING dblib.c:7909:dbperror(04DE9AB8, 20019, 0) dblib.c:7977:dbperror: Calling dblib_err_handler with msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" dblib.c:7999:dbperror: dblib_err_handler for msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" -- returns 2 (INT_CANCEL) dblib.c:3207:dbcancel(04DE9AB8) query.c:2166:tds_send_cancel: not in_cancel and not idle packet.c:773:Sending packet 0000 06 01 00 08 00 00 01 00- |........| token.c:549:tds_process_tokens(04DEA310, 0166F1A0, 00000000, 0x0) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 packet.c:642:Received packet From lacak at zoznam.sk Mon Feb 9 08:54:48 2015 From: lacak at zoznam.sk (LacaK) Date: Mon, 09 Feb 2015 14:54:48 +0100 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: <54D4C208.4020202@zoznam.sk> References: <54D4C208.4020202@zoznam.sk> Message-ID: <54D8BC28.5050309@zoznam.sk> Hi, I have program which uses FreeTDS db-lib.dll Now I have changed TDS version from 7.1 to 7.3 and I start receiving "Attempt to initiate a new Adaptive Server operation with results pending" in some places. For example, when I send this two commands: "IF @@TRANCOUNT>0 ROLLBACK" followed by: "BEGIN TRANSACTION" I get above mentioned error. I attach portion of logs for 7.1 and 7.3 version. As you can see in both cases is returned : more_results = 1 after "IF @@TRANCOUNT>0 ROLLBACK" (I do not understand why?) But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ? Can you give me some explanation what is going on ? Thanks -Laco. P.S. I resend this email to maillist, because first does not arrive there after 3 days -------------- next part -------------- dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) dblib.c:1333:dbcmd(04D59AB8, IF @@TRANCOUNT>0 ROLLBACK) dblib.c:1339:dbcmd() bufsz = 17 dblib.c:5833:dbfreebuf(04D59AB8) dblib.c:1387:dbsqlexec(04D59AB8) dblib.c:6807:dbsqlsend(04D59AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 3a 00 00 01 00-49 00 46 00 20 00 40 00 |...:.... I.F. . at .| 0010 40 00 54 00 52 00 41 00-4e 00 43 00 4f 00 55 00 |@.T.R.A. N.C.O.U.| 0020 4e 00 54 00 3e 00 30 00-20 00 52 00 4f 00 4c 00 |N.T.>.0. .R.O.L.| 0030 4c 00 42 00 41 00 43 00-4b 00 |L.B.A.C. K.| dblib.c:4613:dbsqlok(04D59AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04D5A310, 0166F22C, 0166F23C, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 1a 00 3c 01 00-fd 01 00 c0 00 00 00 00 |.....<.. ........| 0010 00 fd 00 00 d2 00 00 00-00 00 |........ ..| token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04D59AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:1333:dbcmd(04D59AB8, BEGIN TRANSACTION) dblib.c:1339:dbcmd() bufsz = 26 dblib.c:5833:dbfreebuf(04D59AB8) dblib.c:1387:dbsqlexec(04D59AB8) dblib.c:6807:dbsqlsend(04D59AB8) token.c:549:tds_process_tokens(04D5A310, 0166F0C8, 00000000, 0x2282a) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 token.c:2038:tds_process_end() state set to TDS_IDLE util.c:146:Changed query state from READING to IDLE mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet -------------- next part -------------- dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) dblib.c:1333:dbcmd(04DE9AB8, IF @@TRANCOUNT>0 ROLLBACK) dblib.c:1339:dbcmd() bufsz = 17 dblib.c:5833:dbfreebuf(04DE9AB8) dblib.c:1387:dbsqlexec(04DE9AB8) dblib.c:6807:dbsqlsend(04DE9AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 50 00 00 01 00-16 00 00 00 12 00 00 00 |...P.... ........| 0010 02 00 01 00 00 00 37 00-00 00 01 00 00 00 49 00 |......7. ......I.| 0020 46 00 20 00 40 00 40 00-54 00 52 00 41 00 4e 00 |F. . at .@. T.R.A.N.| 0030 43 00 4f 00 55 00 4e 00-54 00 3e 00 30 00 20 00 |C.O.U.N. T.>.0. .| 0040 52 00 4f 00 4c 00 4c 00-42 00 41 00 43 00 4b 00 |R.O.L.L. B.A.C.K.| dblib.c:4613:dbsqlok(04DE9AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04DEA310, 0166F22C, 0166F23C, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 30 00 37 01 00-fd 01 00 c0 00 00 00 00 |...0.7.. ........| 0010 00 00 00 00 00 e3 0b 00-0a 00 08 01 00 00 00 37 |........ .......7| 0020 00 00 00 fd 00 00 d2 00-00 00 00 00 00 00 00 00 |........ ........| token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04DE9AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:1333:dbcmd(04DE9AB8, BEGIN TRANSACTION) dblib.c:1339:dbcmd() bufsz = 26 dblib.c:5833:dbfreebuf(04DE9AB8) dblib.c:1387:dbsqlexec(04DE9AB8) dblib.c:6807:dbsqlsend(04DE9AB8) token.c:549:tds_process_tokens(04DEA310, 0166F0C8, 00000000, 0x2282a) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:830:tds_process_tokens::SET_RETURN stopping on current token util.c:146:Changed query state from READING to PENDING dblib.c:7909:dbperror(04DE9AB8, 20019, 0) dblib.c:7977:dbperror: Calling dblib_err_handler with msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" dblib.c:7999:dbperror: dblib_err_handler for msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" -- returns 2 (INT_CANCEL) dblib.c:3207:dbcancel(04DE9AB8) query.c:2166:tds_send_cancel: not in_cancel and not idle packet.c:773:Sending packet 0000 06 01 00 08 00 00 01 00- |........| token.c:549:tds_process_tokens(04DEA310, 0166F1A0, 00000000, 0x0) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 packet.c:642:Received packet From freddy77 at gmail.com Mon Feb 9 09:42:23 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 9 Feb 2015 14:42:23 +0000 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: <54D8BC28.5050309@zoznam.sk> References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> Message-ID: 2015-02-09 13:54 GMT+00:00 LacaK : > Hi, > I have program which uses FreeTDS db-lib.dll > Now I have changed TDS version from 7.1 to 7.3 and I start receiving > "Attempt to initiate a new Adaptive Server operation with results pending" > in some places. > > For example, when I send this two commands: > "IF @@TRANCOUNT>0 ROLLBACK" > followed by: > "BEGIN TRANSACTION" > > I get above mentioned error. > > I attach portion of logs for 7.1 and 7.3 version. > > As you can see in both cases is returned : more_results = 1 after "IF > @@TRANCOUNT>0 ROLLBACK" > (I do not understand why?) > > But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ? > Can you give me some explanation what is going on ? > > Thanks > -Laco. > P.S. I resend this email to maillist, because first does not arrive there > after 3 days > Yes, was still on stalled for moderation. Mmm... looks like tds 7.3 send transaction id back and dblib does not handle it at terminator tokens. Can you send a small test. Don't think should be hard to fix. Frediano From freddy77 at gmail.com Mon Feb 9 10:03:14 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 9 Feb 2015 15:03:14 +0000 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: <54D8BC28.5050309@zoznam.sk> References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> Message-ID: Frediano 2015-02-09 13:54 GMT+00:00 LacaK : > Hi, > I have program which uses FreeTDS db-lib.dll > Now I have changed TDS version from 7.1 to 7.3 and I start receiving > "Attempt to initiate a new Adaptive Server operation with results pending" > in some places. > > For example, when I send this two commands: > "IF @@TRANCOUNT>0 ROLLBACK" > followed by: > "BEGIN TRANSACTION" > > I get above mentioned error. > > I attach portion of logs for 7.1 and 7.3 version. > > As you can see in both cases is returned : more_results = 1 after "IF > @@TRANCOUNT>0 ROLLBACK" > (I do not understand why?) > > But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ? > Can you give me some explanation what is going on ? > > Thanks > -Laco. > P.S. I resend this email to maillist, because first does not arrive there > after 3 days > Can you try this patch ? diff --git a/include/freetds/tds.h b/include/freetds/tds.h index 4dd3d93..80574e9 100644 --- a/include/freetds/tds.h +++ b/include/freetds/tds.h @@ -215,7 +215,8 @@ enum tds_token_results TDS_TOKEN_RES_ROW, TDS_TOKEN_RES_COMPUTE, TDS_TOKEN_RES_PROC, - TDS_TOKEN_RES_MSG + TDS_TOKEN_RES_MSG, + TDS_TOKEN_RES_ENV, }; #define TDS_TOKEN_FLAG(flag) TDS_RETURN_##flag = (1 << (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << (TDS_TOKEN_RES_##flag*2)) @@ -232,6 +233,7 @@ enum tds_token_flags TDS_TOKEN_FLAG(COMPUTE), TDS_TOKEN_FLAG(PROC), TDS_TOKEN_FLAG(MSG), + TDS_TOKEN_FLAG(ENV), TDS_TOKEN_RESULTS = TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC, TDS_TOKEN_TRAILING = TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS }; diff --git a/src/tds/token.c b/src/tds/token.c index e4561dd..1b4c8c5 100644 --- a/src/tds/token.c +++ b/src/tds/token.c @@ -826,6 +826,10 @@ tds_process_tokens(TDSSOCKET *tds, TDS_INT *result_type, int *done_flags, unsign SET_RETURN(TDS_MSG_RESULT, MSG); rc = tds_process_default_tokens(tds, marker); break; + case TDS_ENVCHANGE_TOKEN: + SET_RETURN(TDS_MSG_RESULT, ENV); + rc = tds_process_default_tokens(tds, marker); + break; default: SET_RETURN(TDS_OTHERS_RESULT, OTHERS); rc = tds_process_default_tokens(tds, marker); Frediano From freddy77 at gmail.com Mon Feb 9 14:11:32 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 9 Feb 2015 19:11:32 +0000 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> Message-ID: 2015-02-09 15:03 GMT+00:00 Frediano Ziglio : > Frediano > > > 2015-02-09 13:54 GMT+00:00 LacaK : >> Hi, >> I have program which uses FreeTDS db-lib.dll >> Now I have changed TDS version from 7.1 to 7.3 and I start receiving >> "Attempt to initiate a new Adaptive Server operation with results pending" >> in some places. >> >> For example, when I send this two commands: >> "IF @@TRANCOUNT>0 ROLLBACK" >> followed by: >> "BEGIN TRANSACTION" >> >> I get above mentioned error. >> >> I attach portion of logs for 7.1 and 7.3 version. >> >> As you can see in both cases is returned : more_results = 1 after "IF >> @@TRANCOUNT>0 ROLLBACK" >> (I do not understand why?) >> >> But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ? >> Can you give me some explanation what is going on ? >> >> Thanks >> -Laco. >> P.S. I resend this email to maillist, because first does not arrive there >> after 3 days >> > > Can you try this patch ? > > > diff --git a/include/freetds/tds.h b/include/freetds/tds.h > index 4dd3d93..80574e9 100644 > --- a/include/freetds/tds.h > +++ b/include/freetds/tds.h > @@ -215,7 +215,8 @@ enum tds_token_results > TDS_TOKEN_RES_ROW, > TDS_TOKEN_RES_COMPUTE, > TDS_TOKEN_RES_PROC, > - TDS_TOKEN_RES_MSG > + TDS_TOKEN_RES_MSG, > + TDS_TOKEN_RES_ENV, > }; > > #define TDS_TOKEN_FLAG(flag) TDS_RETURN_##flag = (1 << > (TDS_TOKEN_RES_##flag*2)), TDS_STOPAT_##flag = (2 << > (TDS_TOKEN_RES_##flag*2)) > @@ -232,6 +233,7 @@ enum tds_token_flags > TDS_TOKEN_FLAG(COMPUTE), > TDS_TOKEN_FLAG(PROC), > TDS_TOKEN_FLAG(MSG), > + TDS_TOKEN_FLAG(ENV), > TDS_TOKEN_RESULTS = > TDS_RETURN_ROWFMT|TDS_RETURN_COMPUTEFMT|TDS_RETURN_DONE|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_RETURN_PROC, > TDS_TOKEN_TRAILING = > TDS_STOPAT_ROWFMT|TDS_STOPAT_COMPUTEFMT|TDS_STOPAT_ROW|TDS_STOPAT_COMPUTE|TDS_STOPAT_MSG|TDS_STOPAT_OTHERS > }; > diff --git a/src/tds/token.c b/src/tds/token.c > index e4561dd..1b4c8c5 100644 > --- a/src/tds/token.c > +++ b/src/tds/token.c > @@ -826,6 +826,10 @@ tds_process_tokens(TDSSOCKET *tds, TDS_INT > *result_type, int *done_flags, unsign > SET_RETURN(TDS_MSG_RESULT, MSG); > rc = tds_process_default_tokens(tds, marker); > break; > + case TDS_ENVCHANGE_TOKEN: > + SET_RETURN(TDS_MSG_RESULT, ENV); > + rc = tds_process_default_tokens(tds, marker); > + break; > default: > SET_RETURN(TDS_OTHERS_RESULT, OTHERS); > rc = tds_process_default_tokens(tds, marker); > This patch fix the problem. Wrote a small test to reproduce. Testing right now. Frediano From lacak at zoznam.sk Tue Feb 10 02:43:03 2015 From: lacak at zoznam.sk (LacaK) Date: Tue, 10 Feb 2015 08:43:03 +0100 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> Message-ID: <54D9B687.5010603@zoznam.sk> >>> Hi, >>> I have program which uses FreeTDS db-lib.dll >>> Now I have changed TDS version from 7.1 to 7.3 and I start receiving >>> "Attempt to initiate a new Adaptive Server operation with results pending" >>> in some places. >>> >>> For example, when I send this two commands: >>> "IF @@TRANCOUNT>0 ROLLBACK" >>> followed by: >>> "BEGIN TRANSACTION" >>> >>> I get above mentioned error. >>> >>> I attach portion of logs for 7.1 and 7.3 version. >>> >>> As you can see in both cases is returned : more_results = 1 after "IF >>> @@TRANCOUNT>0 ROLLBACK" >>> (I do not understand why?) >>> >>> But in case 7.3 is error raised afterward (in 7.1 no error) Is it expected ? >>> Can you give me some explanation what is going on ? >>> >>> Thanks >>> -Laco. >>> P.S. I resend this email to maillist, because first does not arrive there >>> after 3 days >>> >> This patch fix the problem. Wrote a small test to reproduce. Testing right now. Hi Frediano, I can confirm, that your patch fixed the problem. Thank you very much. Only thing, that I do not fully understand is, why in same situation (with same TDS = 7.3): "IF @@TRANCOUNT>0 ROLLBACK" followed by "BEGIN TRANSACTION" does NOT work, but "ROLLBACK" followed by "BEGIN TRANSACTION" does work ? I attach logs from both situations. Thanks Bye -Laco. -------------- next part -------------- dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) dblib.c:1333:dbcmd(04DE9AB8, IF @@TRANCOUNT>0 ROLLBACK) dblib.c:1339:dbcmd() bufsz = 17 dblib.c:5833:dbfreebuf(04DE9AB8) dblib.c:1387:dbsqlexec(04DE9AB8) dblib.c:6807:dbsqlsend(04DE9AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 50 00 00 01 00-16 00 00 00 12 00 00 00 |...P.... ........| 0010 02 00 01 00 00 00 37 00-00 00 01 00 00 00 49 00 |......7. ......I.| 0020 46 00 20 00 40 00 40 00-54 00 52 00 41 00 4e 00 |F. . at .@. T.R.A.N.| 0030 43 00 4f 00 55 00 4e 00-54 00 3e 00 30 00 20 00 |C.O.U.N. T.>.0. .| 0040 52 00 4f 00 4c 00 4c 00-42 00 41 00 43 00 4b 00 |R.O.L.L. B.A.C.K.| dblib.c:4613:dbsqlok(04DE9AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04DEA310, 0166F22C, 0166F23C, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 30 00 37 01 00-fd 01 00 c0 00 00 00 00 |...0.7.. ........| 0010 00 00 00 00 00 e3 0b 00-0a 00 08 01 00 00 00 37 |........ .......7| 0020 00 00 00 fd 00 00 d2 00-00 00 00 00 00 00 00 00 |........ ........| token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04DE9AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:1333:dbcmd(04DE9AB8, BEGIN TRANSACTION) dblib.c:1339:dbcmd() bufsz = 26 dblib.c:5833:dbfreebuf(04DE9AB8) dblib.c:1387:dbsqlexec(04DE9AB8) dblib.c:6807:dbsqlsend(04DE9AB8) token.c:549:tds_process_tokens(04DEA310, 0166F0C8, 00000000, 0x2282a) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:830:tds_process_tokens::SET_RETURN stopping on current token util.c:146:Changed query state from READING to PENDING dblib.c:7909:dbperror(04DE9AB8, 20019, 0) dblib.c:7977:dbperror: Calling dblib_err_handler with msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" dblib.c:7999:dbperror: dblib_err_handler for msgno = 20019; msg->msgtext = "Attempt to initiate a new Adaptive Server operation with results pending" -- returns 2 (INT_CANCEL) dblib.c:3207:dbcancel(04DE9AB8) query.c:2166:tds_send_cancel: not in_cancel and not idle packet.c:773:Sending packet 0000 06 01 00 08 00 00 01 00- |........| token.c:549:tds_process_tokens(04DEA310, 0166F1A0, 00000000, 0x0) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 packet.c:642:Received packet -------------- next part -------------- dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) dblib.c:1333:dbcmd(04DB9AB8, ROLLBACK) dblib.c:1339:dbcmd() bufsz = 17 dblib.c:5833:dbfreebuf(04DB9AB8) dblib.c:1387:dbsqlexec(04DB9AB8) dblib.c:6807:dbsqlsend(04DB9AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 2e 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........| 0010 02 00 01 00 00 00 3e 00-00 00 01 00 00 00 52 00 |......>. ......R.| 0020 4f 00 4c 00 4c 00 42 00-41 00 43 00 4b 00 |O.L.L.B. A.C.K.| dblib.c:4613:dbsqlok(04DB9AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04DBA320, 0166F22C, 0166F23C, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 23 00 3e 01 00-e3 0b 00 0a 00 08 01 00 |...#.>.. ........| 0010 00 00 3e 00 00 00 fd 00-00 d2 00 00 00 00 00 00 |..>..... ........| 0020 00 00 00 - |...| token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 token.c:2038:tds_process_end() state set to TDS_IDLE util.c:146:Changed query state from READING to IDLE util.c:86:logic error: cannot change query state from IDLE to PENDING util.c:146:Changed query state from IDLE to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04DB9AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:1333:dbcmd(04DB9AB8, BEGIN TRANSACTION) dblib.c:1339:dbcmd() bufsz = 9 dblib.c:5833:dbfreebuf(04DB9AB8) dblib.c:1387:dbsqlexec(04DB9AB8) dblib.c:6807:dbsqlsend(04DB9AB8) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 40 00 00 01 00-16 00 00 00 12 00 00 00 |... at .... ........| 0010 02 00 00 00 00 00 00 00-00 00 01 00 00 00 42 00 |........ ......B.| 0020 45 00 47 00 49 00 4e 00-20 00 54 00 52 00 41 00 |E.G.I.N. .T.R.A.| 0030 4e 00 53 00 41 00 43 00-54 00 49 00 4f 00 4e 00 |N.S.A.C. T.I.O.N.| dblib.c:4613:dbsqlok(04DB9AB8) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04DBA320, 0166F1C8, 0166F1D8, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 23 00 3e 01 00-e3 0b 00 08 08 02 00 00 |...#.>.. ........| 0010 00 3e 00 00 00 00 fd 00-00 d4 00 00 00 00 00 00 |.>...... ........| 0020 00 00 00 - |...| token.c:564:processing result tokens. marker is e3(ENVCHANGE) token.c:115:tds_process_default_tokens() marker is e3(ENVCHANGE) token.c:564:processing result tokens. marker is fd(DONE) token.c:2018:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2035: rows_affected = 0 token.c:2038:tds_process_end() state set to TDS_IDLE util.c:146:Changed query state from READING to IDLE util.c:86:logic error: cannot change query state from IDLE to PENDING util.c:146:Changed query state from IDLE to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04DB9AB8) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) From freddy77 at gmail.com Tue Feb 10 04:35:42 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 10 Feb 2015 09:35:42 +0000 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: <54D9B687.5010603@zoznam.sk> References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> <54D9B687.5010603@zoznam.sk> Message-ID: 2015-02-10 7:43 GMT+00:00 LacaK : > >>>> Hi, >>>> I have program which uses FreeTDS db-lib.dll >>>> Now I have changed TDS version from 7.1 to 7.3 and I start receiving >>>> "Attempt to initiate a new Adaptive Server operation with results >>>> pending" >>>> in some places. >>>> >>>> For example, when I send this two commands: >>>> "IF @@TRANCOUNT>0 ROLLBACK" >>>> followed by: >>>> "BEGIN TRANSACTION" >>>> >>>> I get above mentioned error. >>>> >>>> I attach portion of logs for 7.1 and 7.3 version. >>>> >>>> As you can see in both cases is returned : more_results = 1 after "IF >>>> @@TRANCOUNT>0 ROLLBACK" >>>> (I do not understand why?) >>>> >>>> But in case 7.3 is error raised afterward (in 7.1 no error) Is it >>>> expected ? >>>> Can you give me some explanation what is going on ? >>>> >>>> Thanks >>>> -Laco. >>>> P.S. I resend this email to maillist, because first does not arrive >>>> there >>>> after 3 days >>>> >>> This patch fix the problem. Wrote a small test to reproduce. Testing >>> right now. > > > Hi Frediano, > I can confirm, that your patch fixed the problem. > Thank you very much. > > Only thing, that I do not fully understand is, why in same situation (with > same TDS = 7.3): > "IF @@TRANCOUNT>0 ROLLBACK" followed by "BEGIN TRANSACTION" does NOT work, > but > "ROLLBACK" followed by "BEGIN TRANSACTION" does work ? > > I attach logs from both situations. > > Thanks > Bye > -Laco. > Hi, is it still failing? I wrote this change (you should already have a snapshot now) https://gitorious.org/freetds/freetds/commit/03600a47d3975f8cb43d9bc395ec7b9d39a1ec72. It contains a test. Basically the reply from server is in one case DONE, ENV_CHANGE, DONE while in the other is ENV_CHANGE, DONE. Could be that FreeTDS expect upper library to handle one DONE as a results. Frediano From lacak at zoznam.sk Tue Feb 10 04:59:06 2015 From: lacak at zoznam.sk (LacaK) Date: Tue, 10 Feb 2015 10:59:06 +0100 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> <54D9B687.5010603@zoznam.sk> Message-ID: <54D9D66A.7090206@zoznam.sk> D?a 10.2.2015 o 10:35 Frediano Ziglio nap?sal(a): > 2015-02-10 7:43 GMT+00:00 LacaK : >>>>> Hi, >>>>> I have program which uses FreeTDS db-lib.dll >>>>> Now I have changed TDS version from 7.1 to 7.3 and I start receiving >>>>> "Attempt to initiate a new Adaptive Server operation with results >>>>> pending" >>>>> in some places. >>>>> >>>>> For example, when I send this two commands: >>>>> "IF @@TRANCOUNT>0 ROLLBACK" >>>>> followed by: >>>>> "BEGIN TRANSACTION" >>>>> >>>>> I get above mentioned error. >>>>> >>>>> I attach portion of logs for 7.1 and 7.3 version. >>>>> >>>>> As you can see in both cases is returned : more_results = 1 after "IF >>>>> @@TRANCOUNT>0 ROLLBACK" >>>>> (I do not understand why?) >>>>> >>>>> But in case 7.3 is error raised afterward (in 7.1 no error) Is it >>>>> expected ? >>>>> Can you give me some explanation what is going on ? >>>>> >>>>> Thanks >>>>> -Laco. >>>>> P.S. I resend this email to maillist, because first does not arrive >>>>> there >>>>> after 3 days >>>>> >>>> This patch fix the problem. Wrote a small test to reproduce. Testing >>>> right now. >> >> Hi Frediano, >> I can confirm, that your patch fixed the problem. >> Thank you very much. >> >> Only thing, that I do not fully understand is, why in same situation (with >> same TDS = 7.3): >> "IF @@TRANCOUNT>0 ROLLBACK" followed by "BEGIN TRANSACTION" does NOT work, >> but >> "ROLLBACK" followed by "BEGIN TRANSACTION" does work ? >> >> I attach logs from both situations. >> >> Thanks >> Bye >> -Laco. >> > Hi, > is it still failing? I wrote this change (you should already have a > snapshot now) https://gitorious.org/freetds/freetds/commit/03600a47d3975f8cb43d9bc395ec7b9d39a1ec72. > It contains a test. No it is NOT failing, it works well. (As I wrote: "I can confirm, that your patch fixed the problem.") > > Basically the reply from server is in one case DONE, ENV_CHANGE, DONE > while in the other is ENV_CHANGE, DONE. I am only wondering, why: "IF @@TRANCOUNT>0 ROLLBACK" causes reply: DONE, ENV_CHANGE, DONE while "ROLLBACK" causes reply: ENV_CHANGE, DONE > Could be that FreeTDS expect > upper library to handle one DONE as a results. It seems so, but what kind of result it is ? It seems like "IF" formes one result and "ROLLBACK" second result. I am only trying understand why SQL Server replies as replies ;-) -Laco. From freddy77 at gmail.com Tue Feb 10 17:52:23 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 10 Feb 2015 22:52:23 +0000 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: <54D9D66A.7090206@zoznam.sk> References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> <54D9B687.5010603@zoznam.sk> <54D9D66A.7090206@zoznam.sk> Message-ID: 2015-02-10 9:59 GMT+00:00 LacaK : > D?a 10.2.2015 o 10:35 Frediano Ziglio nap?sal(a): > >> 2015-02-10 7:43 GMT+00:00 LacaK : >>>>>> >>>>>> Hi, >>>>>> I have program which uses FreeTDS db-lib.dll >>>>>> Now I have changed TDS version from 7.1 to 7.3 and I start receiving >>>>>> "Attempt to initiate a new Adaptive Server operation with results >>>>>> pending" >>>>>> in some places. >>>>>> >>>>>> For example, when I send this two commands: >>>>>> "IF @@TRANCOUNT>0 ROLLBACK" >>>>>> followed by: >>>>>> "BEGIN TRANSACTION" >>>>>> >>>>>> I get above mentioned error. >>>>>> >>>>>> I attach portion of logs for 7.1 and 7.3 version. >>>>>> >>>>>> As you can see in both cases is returned : more_results = 1 after "IF >>>>>> @@TRANCOUNT>0 ROLLBACK" >>>>>> (I do not understand why?) >>>>>> >>>>>> But in case 7.3 is error raised afterward (in 7.1 no error) Is it >>>>>> expected ? >>>>>> Can you give me some explanation what is going on ? >>>>>> >>>>>> Thanks >>>>>> -Laco. >>>>>> P.S. I resend this email to maillist, because first does not arrive >>>>>> there >>>>>> after 3 days >>>>>> >>>>> This patch fix the problem. Wrote a small test to reproduce. Testing >>>>> right now. >>> >>> >>> Hi Frediano, >>> I can confirm, that your patch fixed the problem. >>> Thank you very much. >>> >>> Only thing, that I do not fully understand is, why in same situation >>> (with >>> same TDS = 7.3): >>> "IF @@TRANCOUNT>0 ROLLBACK" followed by "BEGIN TRANSACTION" does NOT >>> work, >>> but >>> "ROLLBACK" followed by "BEGIN TRANSACTION" does work ? >>> >>> I attach logs from both situations. >>> >>> Thanks >>> Bye >>> -Laco. >>> >> Hi, >> is it still failing? I wrote this change (you should already have a >> snapshot now) >> https://gitorious.org/freetds/freetds/commit/03600a47d3975f8cb43d9bc395ec7b9d39a1ec72. >> It contains a test. > > > No it is NOT failing, it works well. > (As I wrote: "I can confirm, that your patch fixed the problem.") > >> >> Basically the reply from server is in one case DONE, ENV_CHANGE, DONE >> while in the other is ENV_CHANGE, DONE. > > > I am only wondering, why: > "IF @@TRANCOUNT>0 ROLLBACK" > causes reply: > DONE, ENV_CHANGE, DONE > > while > "ROLLBACK" > causes reply: > ENV_CHANGE, DONE > >> Could be that FreeTDS expect >> upper library to handle one DONE as a results. > > > It seems so, but what kind of result it is ? > It seems like "IF" formes one result and "ROLLBACK" second result. > Yes, could be. Try to do a set of IF and see if done is returned every time :-) I know that queries like SELECT @var = 123 produce a DONE while SET @var = 123 don't. Also triggers attached to tables produce DONE tokens. > I am only trying understand why SQL Server replies as replies ;-) > > -Laco. > Frediano From lacak at zoznam.sk Wed Feb 11 02:38:18 2015 From: lacak at zoznam.sk (LacaK) Date: Wed, 11 Feb 2015 08:38:18 +0100 Subject: [freetds] Attempt to initiate a new Adaptive Server operation with results pending In-Reply-To: References: <54D4C208.4020202@zoznam.sk> <54D8BC28.5050309@zoznam.sk> <54D9B687.5010603@zoznam.sk> <54D9D66A.7090206@zoznam.sk> Message-ID: <54DB06EA.3030800@zoznam.sk> D?a 10.2.2015 o 23:52 Frediano Ziglio nap?sal(a): > I am only wondering, why: "IF @@TRANCOUNT>0 ROLLBACK" causes reply: > DONE, ENV_CHANGE, DONE while "ROLLBACK" causes reply: ENV_CHANGE, DONE >>> Could be that FreeTDS expect >>> upper library to handle one DONE as a results. >> >> It seems so, but what kind of result it is ? >> It seems like "IF" formes one result and "ROLLBACK" second result. >> > Yes, could be. Try to do a set of IF and see if done is returned every time :-) > I know that queries like SELECT @var = 123 produce a DONE while SET > @var = 123 don't. Also triggers attached to tables produce DONE > tokens. Yes it seems, so, that: "if @id=1 set @id=2;" produces 2 times DONE To be right, it seems, that every statement in batch generates DONE. (see tds73_set.txt, where are 3 set statements) Which is okay for me, as far as "_dbresults" (in dblib.c) processes all these DONE tokens internally in loop. (and do not require upper level library to hande it by call dbresults() for each individual command in batch) There is also comment in source code: /* A done token signifies the end of a logical command. * There are three possibilities: * 1. Simple command with no result set, i.e. update, delete, insert * 2. Command with result set but no rows * 3. Command with result set and rows */ Thanks again for fixing case DONE, ENV_CHANGE, DONE -Laco. -------------- next part -------------- dblib.c:1333:dbcmd(04CF1190, declare @id int; set @id=1; if @id=1 set @id=2; if @id=2 set @id=3; if @id=3 set @id=4;) dblib.c:1339:dbcmd() bufsz = 407 dblib.c:5833:dbfreebuf(04CF1190) dblib.c:1387:dbsqlexec(04CF1190) dblib.c:6807:dbsqlsend(04CF1190) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 cc 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........| 0010 02 00 01 00 00 00 57 00-00 00 01 00 00 00 64 00 |......W. ......d.| 0020 65 00 63 00 6c 00 61 00-72 00 65 00 20 00 40 00 |e.c.l.a. r.e. . at .| 0030 69 00 64 00 20 00 69 00-6e 00 74 00 3b 00 20 00 |i.d. .i. n.t.;. .| 0040 73 00 65 00 74 00 20 00-40 00 69 00 64 00 3d 00 |s.e.t. . @.i.d.=.| 0050 31 00 3b 00 20 00 69 00-66 00 20 00 40 00 69 00 |1.;. .i. f. . at .i.| 0060 64 00 3d 00 31 00 20 00-73 00 65 00 74 00 20 00 |d.=.1. . s.e.t. .| 0070 40 00 69 00 64 00 3d 00-32 00 3b 00 20 00 69 00 |@.i.d.=. 2.;. .i.| 0080 66 00 20 00 40 00 69 00-64 00 3d 00 32 00 20 00 |f. . at .i. d.=.2. .| 0090 73 00 65 00 74 00 20 00-40 00 69 00 64 00 3d 00 |s.e.t. . @.i.d.=.| 00a0 33 00 3b 00 20 00 69 00-66 00 20 00 40 00 69 00 |3.;. .i. f. . at .i.| 00b0 64 00 3d 00 33 00 20 00-73 00 65 00 74 00 20 00 |d.=.3. . s.e.t. .| 00c0 40 00 69 00 64 00 3d 00-34 00 3b 00 |@.i.d.=. 4.;.| dblib.c:4613:dbsqlok(04CF1190) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04CF1358, 0166F198, 0166F1A0, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 63 00 57 01 00-fd 11 00 c1 00 01 00 00 |...c.W.. ........| 0010 00 00 00 00 00 fd 01 00-c0 00 00 00 00 00 00 00 |........ ........| 0020 00 00 fd 11 00 c1 00 01-00 00 00 00 00 00 00 fd |........ ........| 0030 01 00 c0 00 00 00 00 00-00 00 00 00 fd 11 00 c1 |........ ........| 0040 00 01 00 00 00 00 00 00-00 fd 01 00 c0 00 00 00 |........ ........| 0050 00 00 00 00 00 00 fd 10-00 c1 00 01 00 00 00 00 |........ ........| 0060 00 00 00 - |...| token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04CF1190) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:4070:dbcmdrow(04CF1190) dblib.c:2790:dbcount(04CF1190) dblib.c:2770:dbiscount(04CF1190) dblib.c:2026:dbnextrow(04CF1190) dblib.c:2038:dbnextrow() dbresults_state = 3 (_DB_RES_NEXT_RESULT) dblib.c:2043:leaving dbnextrow() returning -2 (NO_MORE_ROWS) dblib.c:1683:dbresults(04CF1190) dblib.c:1688:dbresults: dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2039: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 util.c:146:Changed query state from READING to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2039: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 util.c:146:Changed query state from READING to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 0 token.c:2039: rows_affected = 0 util.c:146:Changed query state from READING to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 token.c:2042:tds_process_end() state set to TDS_IDLE util.c:146:Changed query state from READING to IDLE util.c:86:logic error: cannot change query state from IDLE to PENDING util.c:146:Changed query state from IDLE to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04CF1358, 0166F1AC, 0166F1B0, 0x6914) token.c:552:tds_process_tokens() state is COMPLETED dblib.c:1709:dbresults() tds_process_tokens returned 1 (TDS_NO_MORE_RESULTS), result_type TDS_DONE_RESULT dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) -------------- next part -------------- dblib.c:1333:dbcmd(04D51190, declare @id int; set @id=1; set @id=2; set @id=3;) dblib.c:1339:dbcmd() bufsz = 407 dblib.c:5833:dbfreebuf(04D51190) dblib.c:1387:dbsqlexec(04D51190) dblib.c:6807:dbsqlsend(04D51190) mem.c:645:tds_free_all_results() util.c:146:Changed query state from IDLE to QUERYING util.c:146:Changed query state from QUERYING to PENDING packet.c:743:Sending packet 0000 01 01 00 80 00 00 01 00-16 00 00 00 12 00 00 00 |........ ........| 0010 02 00 01 00 00 00 5e 00-00 00 01 00 00 00 64 00 |......^. ......d.| 0020 65 00 63 00 6c 00 61 00-72 00 65 00 20 00 40 00 |e.c.l.a. r.e. . at .| 0030 69 00 64 00 20 00 69 00-6e 00 74 00 3b 00 20 00 |i.d. .i. n.t.;. .| 0040 73 00 65 00 74 00 20 00-40 00 69 00 64 00 3d 00 |s.e.t. . @.i.d.=.| 0050 31 00 3b 00 20 00 73 00-65 00 74 00 20 00 40 00 |1.;. .s. e.t. . at .| 0060 69 00 64 00 3d 00 32 00-3b 00 20 00 73 00 65 00 |i.d.=.2. ;. .s.e.| 0070 74 00 20 00 40 00 69 00-64 00 3d 00 33 00 3b 00 |t. . at .i. d.=.3.;.| dblib.c:4613:dbsqlok(04D51190) dblib.c:4642:dbsqlok() not done, calling tds_process_tokens() token.c:549:tds_process_tokens(04D51358, 0166F198, 0166F1A0, 0x6914) util.c:146:Changed query state from PENDING to READING packet.c:642:Received packet 0000 04 01 00 2f 00 5e 01 00-fd 11 00 c1 00 01 00 00 |.../.^.. ........| 0010 00 00 00 00 00 fd 11 00-c1 00 01 00 00 00 00 00 |........ ........| 0020 00 00 fd 10 00 c1 00 01-00 00 00 00 00 00 00 |........ .......| token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 util.c:146:Changed query state from READING to PENDING dblib.c:4675:dbsqlok() end status is SUCCEED dblib.c:4686:dbsqlok() end status was success dblib.c:1683:dbresults(04D51190) dblib.c:1688:dbresults: dbresults_state is 5 (_DB_RES_SUCCEED) dblib.c:1673:dbresults returning 1 (SUCCEED) dblib.c:4070:dbcmdrow(04D51190) dblib.c:2790:dbcount(04D51190) dblib.c:2770:dbiscount(04D51190) dblib.c:2026:dbnextrow(04D51190) dblib.c:2038:dbnextrow() dbresults_state = 3 (_DB_RES_NEXT_RESULT) dblib.c:2043:leaving dbnextrow() returning -2 (NO_MORE_ROWS) dblib.c:1683:dbresults(04D51190) dblib.c:1688:dbresults: dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04D51358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 1 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 util.c:146:Changed query state from READING to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04D51358, 0166F1AC, 0166F1B0, 0x6914) util.c:146:Changed query state from PENDING to READING token.c:564:processing result tokens. marker is fd(DONE) token.c:2022:tds_process_end: more_results = 0 was_cancelled = 0 error = 0 done_count_valid = 1 token.c:2039: rows_affected = 1 token.c:2042:tds_process_end() state set to TDS_IDLE util.c:146:Changed query state from READING to IDLE util.c:86:logic error: cannot change query state from IDLE to PENDING util.c:146:Changed query state from IDLE to PENDING dblib.c:1709:dbresults() tds_process_tokens returned 0 (TDS_SUCCESS), result_type TDS_DONE_RESULT dblib.c:1736:dbresults(): dbresults_state is 3 (_DB_RES_NEXT_RESULT) token.c:549:tds_process_tokens(04D51358, 0166F1AC, 0166F1B0, 0x6914) token.c:552:tds_process_tokens() state is COMPLETED dblib.c:1709:dbresults() tds_process_tokens returned 1 (TDS_NO_MORE_RESULTS), result_type TDS_DONE_RESULT dblib.c:1673:dbresults returning 2 (NO_MORE_RESULTS) From freddy77 at gmail.com Wed Feb 11 13:59:02 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Wed, 11 Feb 2015 18:59:02 +0000 Subject: [freetds] Snapshot is now working !! In-Reply-To: References: Message-ID: Il 05/Feb/2015 21:50 "James Fisher" ha scritto: > > >I'm now trying to collect things to do before a possible release. > > Like a proper logout for ASA to eliminate the ''Connection terminated > abnormally" errors? > > :D :D :D > > Topic here: http://article.gmane.org/gmane.comp.db.tds.freetds/15678/ > Well looks like now should be working, and now is passing the tests too. I sent a patched version to James to confirm that sending logout token to server avoid the warning however tests didn't pass. I modified the patch and now is working correctly. It's already in the snapshot. James, can you confirm it's working? Frediano > On Thu, Feb 5, 2015 at 2:33 PM, Frediano Ziglio wrote: > > > Hi, > > a couple of days ago I fixed the snapshot generation. In particular > > userguide and reference are now generated. Also freetds-current* files > > point to the right versions so from the website you can just download > > the "Current Snapshot" (http://www.freetds.org/software.html). > > > > I'm now trying to collect things to do before a possible release. > > > > Regards, > > Frediano > > _______________________________________________ > > 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 From freddy77 at gmail.com Sun Feb 15 04:56:57 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 15 Feb 2015 09:56:57 +0000 Subject: [freetds] Fwd: FreeTDS on OSX 10.10 losing precision In-Reply-To: References: Message-ID: 2014-12-05 15:03 GMT+00:00 Alex Derbes : > I have FreeTDS 0.91 installed on Mac OSX 10.10. When Querying a SQLServer > 2012 database, columns defined with double precision numbers are truncated > to single precision. I've checked the query with both sqsh and with the > python pymssql driver and get the same result. > > Is it possible that I need to set something in my freetds.conf file to > enable double precision math? > > Or is it possible that the column definition in the SQL Server database is > being incorrectly marshaled to a single precision number? > > Thanks, > --Alex Derbes > > The version of FreeTDS came from brew, here is the version information: > > freetds: stable 0.91, HEAD > > http://www.freetds.org/ > > /usr/local/Cellar/freetds/0.91_2 (600 files, 10.0M) * > > Built from source > > From: > https://github.com/Homebrew/homebrew/blob/master/Library/Formula/freetds.rb I don't think FreeTDS will loose precision on protocol. Double precision is very old and supported by all TDS versions. What I think is that the conversion just format the string will less precision than what you expect. Some time ago there has been a patch on this direction. Can you try a snapshot version? See http://www.freetds.org/software.html. Frediano From freddy77 at gmail.com Sun Feb 15 05:16:51 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 15 Feb 2015 10:16:51 +0000 Subject: [freetds] Starting preparing a new release Message-ID: Hi, I finally found some time to start preparing a new release. This morning I went throw my todo list and marked mails trying to prepare a todo list for the release. Still in early stage but I posted on https://trello.com/b/bk0UZNRJ/freetds-todo-list (well, it's all open stuff :) ). I don't know much about Trello so if you need write access just ask it. This time I'm really alone in this so please any help is really appreciated. FreeTDS has a lot of documentations to update and there has been quite a lot of changes from 0.91 (there are more or less 850 patches from the fork). Frediano From lacak at zoznam.sk Mon Feb 16 01:11:07 2015 From: lacak at zoznam.sk (LacaK) Date: Mon, 16 Feb 2015 07:11:07 +0100 Subject: [freetds] Starting preparing a new release In-Reply-To: References: Message-ID: <54E189FB.20301@zoznam.sk> Hi Frediano, can you please estimate when probably new release will be released ? It is question of 2-3 weeks, or 2-3 months, or more ? I have prepared precompiled dblib.dll (Win32/Win64) for Lazarus/FreePascal project based on current "master" and I would like to know if I should wait for new release or publish what I already have. Thanks I would like to help you, with documentation, but only area where I can help is dblib and there was not big changes in functions signatures. (I am only aware of : support for new 2008 data types and new DBCOL2 structure) -Laco. > Hi, > I finally found some time to start preparing a new release. This > morning I went throw my todo list and marked mails trying to prepare a > todo list for the release. > > Still in early stage but I posted on > https://trello.com/b/bk0UZNRJ/freetds-todo-list (well, it's all open > stuff :) ). I don't know much about Trello so if you need write access > just ask it. > > This time I'm really alone in this so please any help is really > appreciated. FreeTDS has a lot of documentations to update and there > has been quite a lot of changes from 0.91 (there are more or less 850 > patches from the fork). > > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > From freddy77 at gmail.com Tue Feb 17 11:53:23 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 17 Feb 2015 16:53:23 +0000 Subject: [freetds] Starting preparing a new release In-Reply-To: <54E189FB.20301@zoznam.sk> References: <54E189FB.20301@zoznam.sk> Message-ID: 2015-02-16 6:11 GMT+00:00 LacaK : > Hi Frediano, > can you please estimate when probably new release will be released ? > It is question of 2-3 weeks, or 2-3 months, or more ? Weeks I would be too optimistic, looking at my recent time schedule and progresses I hope a couple of months. > I have prepared precompiled dblib.dll (Win32/Win64) for Lazarus/FreePascal > project based on current "master" and I would like to know if I should wait > for new release or publish what I already have. > Thanks > It's hard to say actually. It depends on how many change will be included. The SSL fix require some changes in the configuration (basically certificate must be registered somewhere as it cannot be automatically accepted). > I would like to help you, with documentation, but only area where I can help > is dblib and there was not big changes in functions signatures. > (I am only aware of : support for new 2008 data types and new DBCOL2 > structure) > -Laco. > I tried to do a "simple" diff from 0.91 and master... well... more than 400 files changed and dozen of thousands lines. As libTDS core changed many optimization improvements went inside all libraries. Conversions, data types and bulk improvements are just some that came into my mind. Frediano >> Hi, >> I finally found some time to start preparing a new release. This >> morning I went throw my todo list and marked mails trying to prepare a >> todo list for the release. >> >> Still in early stage but I posted on >> https://trello.com/b/bk0UZNRJ/freetds-todo-list (well, it's all open >> stuff :) ). I don't know much about Trello so if you need write access >> just ask it. >> >> This time I'm really alone in this so please any help is really >> appreciated. FreeTDS has a lot of documentations to update and there >> has been quite a lot of changes from 0.91 (there are more or less 850 >> patches from the fork). >> >> Frediano From freddy77 at gmail.com Sun Feb 22 07:43:43 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 22 Feb 2015 12:43:43 +0000 Subject: [freetds] Removing old memory debugging code Message-ID: Hi, I noted that there are some residual attempt to use some memory debugging all around. One is the manual "crumbs" in dblib tests and the other is a lot of includes for dmalloc headers. They are quite confusing, not used since a while and probably not that updated (valgrind is used instead which is much easier and does not require source changes). If nobody complain I will remove both from sources. Frediano From legrandmarc20 at hotmail.com Fri Feb 27 09:14:52 2015 From: legrandmarc20 at hotmail.com (=?iso-8859-1?B?TWFyYy1BbmRy6SBMZWdyYW5k?=) Date: Fri, 27 Feb 2015 15:14:52 +0100 Subject: [freetds] Looking up hostname from IP address and connection problem MS SQL Server from php Message-ID: Hello, I installed FreeTDS on CentOS 6.6 and I have a connection problem between PHP Server and MS SQL Server 2014. I have the following message : Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, SQL state S1000 in SQLConnect After FreeTDS installation I made a test by : # tsql -C Compile-time settings (established with the "configure" script) Version: freetds v0.91 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 SSPI "trusted" logins: no Kerberos: yes It is a FreeTDS RPM version that I have got . Here is Linux Server feature : CentOS 6.6 Php 5.3.3 Apache 2.2.15 unixodbc 2.2.14 freetds 0.91 My Windows Server : Windows Server 2012 R2 MS SQL Server 2014 Standard Edition Here is the command line that I executed : # osql -S MyMSSQLServerName -U user -P password My result of this command : checking shared odbc libraries linked to isql for default directories... strings: '': No such file trying /tmp/sqlH ... no trying /tmp/sqlL ... no trying /etc ... OK checking odbc.ini files cannot read "/root/.odbc.ini" reading /etc/odbc.ini [MyMSSQLServerName] found in /etc/odbc.ini found this section: [MyMSSQLServerName] Driver = /usr/lib64/libtdsodbc.so.0 Description = MSSQL Server Trace = No Server = 192.168.1.32 Database = mydatabase Port = 1433 TDS_Version = 7.2 looking for driver for DSN [MyMSSQLServerName] in /etc/odbc.ini found driver line: " Driver = /usr/lib64/libtdsodbc.so.0" driver "/usr/lib64/libtdsodbc.so.0" found for [MyMSSQLServerName] in odbc.ini found driver named "/usr/lib64/libtdsodbc.so.0" /usr/lib64/libtdsodbc.so.0 is an executable file "Server" found, not using freetds.conf Server is "192.168.1.32" looking up hostname for ip address 192.168.1.32 osql: warning: no DNS hostname found for "192.168.1.32" Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time] [-R number] [-m flag] hostname [server] -a is equivalent to -v -t ANY -c specifies query class for non-IN data -C compares SOA records on authoritative nameservers -d is equivalent to -v -l lists all hosts in a domain, using AXFR -i IP6.INT reverse lookups -N changes the number of dots allowed before root lookup is done -r disables recursive processing -R specifies number of retries for UDP packets -s a SERVFAIL response should stop query -t specifies the query type -T enables TCP/IP mode -v enables verbose output -w specifies to wait forever for a reply -W specifies how long to wait for a reply -4 use IPv4 query transport only -6 use IPv6 query transport only -m set memory debugging flag (trace|record|usage) osql: no IP address found for "" Here is my ODBC configuration ==================================================================== /etc/odbc.ini for osql [ODBC Data Sources] MyMSSQLServerName=MSSQL Server [MyMSSQLServerName] Driver = /usr/lib64/libtdsodbc.so.0 Description = MSSQL Server Trace = No Server = 192.168.1.32 Database = mydatabase Port = 1433 TDS_Version = 7.2 [Default] Driver=/usr/lib64/libtdsodbc.so.0 ================================================================ /etc/odbcinst.ini for php # Example driver definitions # Driver from the postgresql-odbc package # Setup from the unixODBC package [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/psqlodbc.so Setup = /usr/lib/libodbcpsqlS.so Driver64 = /usr/lib64/psqlodbc.so Setup64 = /usr/lib64/libodbcpsqlS.so FileUsage = 1 # Driver from the mysql-connector-odbc package # Setup from the unixODBC package [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc5.so Setup = /usr/lib/libodbcmyS.so Driver64 = /usr/lib64/libmyodbc5.so Setup64 = /usr/lib64/libodbcmyS.so FileUsage = 1 [FreeTDS] Driver = /usr/lib64/libtdsodbc.so.0 Setup = /usr/lib64/libtdsS.so Description = MSSQL Server Trace = No Server = 192.168.1.32 Database = mydatabase Port = 1433 TDS_Version = 7.2 ===================================================================== /etc/freetds.conf # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ # # This file is installed by FreeTDS if no file by the same # name is found in the installation directory. # # For information about the layout of this file and its settings, # see the freetds.conf manpage "man freetds.conf". # Global settings are overridden by those in a database # server specific section [global] # TDS protocol version ; tds version = 4.2 # Whether to write a TDSDUMP file for diagnostic purposes # (setting this to /tmp is insecure on a multi-user system) ; dump file = /tmp/freetds.log ; debug flags = 0xffff # Command and connection timeouts ; timeout = 10 ; connect timeout = 10 # If you get out-of-memory errors, it may mean that your client # is trying to allocate a huge buffer for a TEXT field. # Try setting 'text size' to a more reasonable limit text size = 64512 # A typical Sybase server [egServer50] host = symachine.domain.com port = 5000 tds version = 5.0 # A typical Microsoft server [egServer70] host = ntmachine.domain.com port = 1433 tds version = 7.0 ## I added theses lines below # MSSQL ServerName [MyMSSQLServerName] host = 192.168.1.32 port = 1433 tds version = 7.0 # client charset = UTF-8 ==================================================================================== ======== My connection string in php file : Driver=FreeTDS;Server=192.168.1.32;Database=mydatabase; Another information about CentOS, I disabled SELinux . The osql searches DNS hostname from the IP address that I given but it didn't find. I don't know if the connection problem from php to SQL Server is due by the lookup DNS problem from the IP address. I would like to know what should I do to resolve this connection problem ? Thank you for your response. Best regards. From freddy77 at gmail.com Sun Mar 1 03:11:48 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 1 Mar 2015 08:11:48 +0000 Subject: [freetds] Looking up hostname from IP address and connection problem MS SQL Server from php In-Reply-To: References: Message-ID: 2015-02-27 14:14 GMT+00:00 Marc-Andr? Legrand : > > > > Hello, > > I installed FreeTDS on CentOS 6.6 and I have a connection problem between > PHP Server and MS SQL Server 2014. I have the following message : > Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect > to data source, SQL state S1000 in SQLConnect > After FreeTDS installation I made a test by : > # tsql -C > Compile-time settings (established with the "configure" script) > Version: freetds v0.91 > 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 > SSPI "trusted" logins: no > Kerberos: yes > > > It is a FreeTDS RPM version that I have got . > Here is Linux Server feature : > CentOS 6.6 > Php 5.3.3 > Apache 2.2.15 > unixodbc 2.2.14 > freetds 0.91 > My Windows Server : > Windows Server 2012 R2 > MS SQL Server 2014 Standard Edition > Here is the command line that I executed : > # osql -S MyMSSQLServerName -U user -P password > > My result of this command : > checking shared odbc libraries linked to isql for default directories... > strings: '': No such file > trying /tmp/sqlH ... no > trying /tmp/sqlL ... no > trying /etc ... OK > checking odbc.ini files > cannot read "/root/.odbc.ini" > reading /etc/odbc.ini > [MyMSSQLServerName] found in /etc/odbc.ini > found this section: > [MyMSSQLServerName] > Driver = /usr/lib64/libtdsodbc.so.0 > Description = MSSQL Server > Trace = No > Server = 192.168.1.32 > Database = mydatabase > Port = 1433 > TDS_Version = 7.2 > > looking for driver for DSN [MyMSSQLServerName] in /etc/odbc.ini > found driver line: " Driver = /usr/lib64/libtdsodbc.so.0" > driver "/usr/lib64/libtdsodbc.so.0" found for [MyMSSQLServerName] in odbc.ini > found driver named "/usr/lib64/libtdsodbc.so.0" > /usr/lib64/libtdsodbc.so.0 is an executable file > "Server" found, not using freetds.conf > Server is "192.168.1.32" > looking up hostname for ip address 192.168.1.32 > osql: warning: no DNS hostname found for "192.168.1.32" > Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time] > [-R number] [-m flag] hostname [server] > -a is equivalent to -v -t ANY > -c specifies query class for non-IN data > -C compares SOA records on authoritative nameservers > -d is equivalent to -v > -l lists all hosts in a domain, using AXFR > -i IP6.INT reverse lookups > -N changes the number of dots allowed before root lookup is done > -r disables recursive processing > -R specifies number of retries for UDP packets > -s a SERVFAIL response should stop query > -t specifies the query type > -T enables TCP/IP mode > -v enables verbose output > -w specifies to wait forever for a reply > -W specifies how long to wait for a reply > -4 use IPv4 query transport only > -6 use IPv6 query transport only > -m set memory debugging flag (trace|record|usage) > osql: no IP address found for "" I think this is just a problem of osql, FreeTDS is able to use ip directly in server. > > Here is my ODBC configuration > ==================================================================== > /etc/odbc.ini for osql > [ODBC Data Sources] > MyMSSQLServerName=MSSQL Server > [MyMSSQLServerName] > Driver = /usr/lib64/libtdsodbc.so.0 > Description = MSSQL Server > Trace = No > Server = 192.168.1.32 > Database = mydatabase > Port = 1433 > TDS_Version = 7.2 Looks good > [Default] > Driver=/usr/lib64/libtdsodbc.so.0 > ================================================================ > /etc/odbcinst.ini for php > # Example driver definitions > # Driver from the postgresql-odbc package > # Setup from the unixODBC package > [PostgreSQL] > Description = ODBC for PostgreSQL > Driver = /usr/lib/psqlodbc.so > Setup = /usr/lib/libodbcpsqlS.so > Driver64 = /usr/lib64/psqlodbc.so > Setup64 = /usr/lib64/libodbcpsqlS.so > FileUsage = 1 > > # Driver from the mysql-connector-odbc package > # Setup from the unixODBC package > [MySQL] > Description = ODBC for MySQL > Driver = /usr/lib/libmyodbc5.so > Setup = /usr/lib/libodbcmyS.so > Driver64 = /usr/lib64/libmyodbc5.so > Setup64 = /usr/lib64/libodbcmyS.so > FileUsage = 1 > > [FreeTDS] > Driver = /usr/lib64/libtdsodbc.so.0 > Setup = /usr/lib64/libtdsS.so > Description = MSSQL Server > Trace = No > Server = 192.168.1.32 > Database = mydatabase > Port = 1433 > TDS_Version = 7.2 These 4 lines here are useless and confusing, odbcinst.ini is just for drivers, not connections. It's better to set Setup for unixODBC with same value as Driver (FreeTDS provide a Setup). > ===================================================================== > /etc/freetds.conf > # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ > # > # This file is installed by FreeTDS if no file by the same > # name is found in the installation directory. > # > # For information about the layout of this file and its settings, > # see the freetds.conf manpage "man freetds.conf". > # Global settings are overridden by those in a database > # server specific section > [global] > # TDS protocol version > ; tds version = 4.2 > # Whether to write a TDSDUMP file for diagnostic purposes > # (setting this to /tmp is insecure on a multi-user system) > ; dump file = /tmp/freetds.log > ; debug flags = 0xffff > # Command and connection timeouts > ; timeout = 10 > ; connect timeout = 10 > > # If you get out-of-memory errors, it may mean that your client > # is trying to allocate a huge buffer for a TEXT field. > # Try setting 'text size' to a more reasonable limit > text size = 64512 > # A typical Sybase server > [egServer50] > host = symachine.domain.com > port = 5000 > tds version = 5.0 > # A typical Microsoft server > [egServer70] > host = ntmachine.domain.com > port = 1433 > tds version = 7.0 ## I added theses lines below > # MSSQL ServerName > [MyMSSQLServerName] > host = 192.168.1.32 > port = 1433 > tds version = 7.0 > # client charset = UTF-8 > ==================================================================================== > ======== > > My connection string in php file : > Driver=FreeTDS;Server=192.168.1.32;Database=mydatabase; > You should use DSN here to refer the entry you configured in odbc.ini. Also you should try with isql tools to connect. Something like "DSN=MyMSSQLServerName;UID=user;PWD=password;" replacing user and password. You need either to provide a username/password or setup Kerberos. > Another information about CentOS, I disabled SELinux . > The osql searches DNS hostname from the IP address that I given but it didn't find. > > I don't know if the connection problem from php to SQL Server is due by the lookup DNS problem from the IP address. > > I would like to know what should I do to resolve this connection problem ? > > Thank you for your response. > > Best regards. > Frediano From craigberry at mac.com Sun Mar 1 11:19:54 2015 From: craigberry at mac.com (Craig A. Berry) Date: Sun, 01 Mar 2015 10:19:54 -0600 Subject: [freetds] [PATCH] Handle empty char/varchar in bcp round trip (Re: bp with empty char/varchar column broken) In-Reply-To: <2FE95B42-7EA0-47EB-9D65-056C16C470CC@mac.com> References: <2D7AEB19-038B-427C-B5F6-40BB7A389CE7@mac.com> <2FE95B42-7EA0-47EB-9D65-056C16C470CC@mac.com> Message-ID: <5C207B6E-D577-44D6-B17D-564BBA4DBB9E@mac.com> > On Nov 21, 2014, at 9:43 AM, Craig A. Berry wrote: > > >> On Nov 21, 2014, at 5:58 AM, Frediano Ziglio wrote: >> >> 2014-11-20 19:53 GMT+00:00 Craig A. Berry : >>> The following worked in 0.91 but is broken as of branch-0_92-839-gd788046. If we bulk out a table with an empty (but not NULL) char or varchar column that is less than 256 bytes long, 256 spaces get written to the output file for that column. Which then causes an overflow error if you try to bulk it back in. >> > >> Quite strange. Why does it happen only for empty strings? Should even >> happen with small ones. The function has to pad or not based on type. > > The actual length of the string received on the wire is passed as the source length to dbconvert, and dbconvert (usually) uses that as its return value, and that return value is passed to fwrite for moving data to the file. > > But if the source length is zero, dbconvert uses the destination length as its return value as long as the destination length is greater than zero. Since it's now always 256, we get 256 spaces. > >> Actually is not clear to me what an empty column should look like in >> the text bcp file. > > I'm pretty sure a zero-length column in a bcp file indicates NULL, and one or more spaces indicates empty string and will be trimmed on bulk in. I have studied this a bit more now. What the Microsoft client does consistently is output a single ASCII NUL to indicate an empty string in the database column and an empty string to indicate a database NULL. I don't have any Sybase clients to test with and I haven't found any documentation indicating how it works so I don't know if this is part of the BCP spec or just something Microsoft did. The attached patch modifies _bcp_exec_out and _bcp_read_hostfile so FreeTDS does the same thing Microsoft bcp does. Without this, we don't handle empty strings correctly round trip in bcp. ________________________________________ Craig A. Berry mailto:craigberry at mac.com "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Handle-empty-char-varchar-in-bcp-round-trip.patch Type: application/octet-stream Size: 4952 bytes Desc: not available URL: From james.k.lowden at icloud.com Sun Mar 1 17:25:12 2015 From: james.k.lowden at icloud.com (James K. Lowden) Date: Sun, 01 Mar 2015 17:25:12 -0500 Subject: [freetds] Looking up hostname from IP address and connection problem MS SQL Server from php In-Reply-To: References: Message-ID: <20150301172512.50f09107.james.k.lowden@icloud.com> On Fri, 27 Feb 2015 15:14:52 +0100 Marc-Andr? Legrand wrote: > Server is "192.168.1.32" > looking up hostname for ip address 192.168.1.32 > osql: warning: no DNS hostname found for "192.168.1.32" > Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time] > [-R number] [-m flag] hostname [server] [etc.] > -m set memory debugging flag (trace|record|usage) > osql: no IP address found for "" There is an odd error in osql that I don't see. I would run it as $ sh -x $(which osql) -S MyMSSQLServerName -U user -P password to watch for the last assignment to the HOST variable. The relevant lines start at line 340: if [ "${HOST}" = "$(echo ${HOST} | sed 's/[^.0-9]*//')" ] then ADDRESS=${HOST} echo 'looking up hostname for ip address' ${ADDRESS} HOST=$(host ${HOST} | awk '/domain/ {print $5}' | sed 's/\.$//') if [ -z "${HOST}" ] then echo "$(basename $0): warning: \ no DNS hostname found for \"${ADDRESS}\"" HOST=${ADDRESS} # restore host address string fi fi In English: if host is all numeric characters addr = host # save name look for hostname of address with host->awk->sed if no hostname found (host is "") issue message host = addr # restore name I don't see how that can fail. Logically, it seems that if [ -z "${HOST}" ] evaluates to False even though HOST is in fact a zero-length string. We know it's numeric going in because we see the message osql: warning: no DNS hostname found for "192.168.1.32" and zero-length coming out because we see osql: no IP address found for "" Running the script with the -x option should reveal where it goes wrong. BTW, this test might be improved: [ "${HOST}" = "$(echo ${HOST} | sed 's/[^.0-9]*//')" ] written as [ ${HOST} -a -z ${HOST%%[.0-9]*} ] The first version tests if HOST is the same after non-digits (and '.') are removed. The second tests if HOST comprises only digits and '.'. The things you learn.... --jkl From jorge at jorgechamorro.com Sun Mar 1 19:05:12 2015 From: jorge at jorgechamorro.com (Jorge Chamorro) Date: Mon, 2 Mar 2015 01:05:12 +0100 Subject: [freetds] Awesome awesome awesome Message-ID: Hi, I'm a new user of FreeTDS and would like to say that it's working fine for me. I've installed it on a raspberrypi 2 in order to provide an plain text sql interface to the db, via tsql via netcat for the rest of the network/clients. They mostly send some small batches of sql every now and then. I've had to tweak tsql.c a little bit because it was sending some things/results to stderr that ISTM should be going to stdout instead, and also for some reason at times (and only on the raspberrypi) it wasn't flushing stdout properly, nothing that a few fflush(stdout)s here and there don't fix, and now I have a nice working text interface to the azure ms-sql db. Awesome! So, in return, I'd like to donate to the cause, but I can't find the instructions anywhere to do so. (?) Thank you! -- ( Jorge )(); From lacak at zoznam.sk Mon Mar 2 01:51:19 2015 From: lacak at zoznam.sk (LacaK) Date: Mon, 02 Mar 2015 07:51:19 +0100 Subject: [freetds] varbinary(MAX) and DBCOL.MaxLength Message-ID: <54F40867.2080800@zoznam.sk> Hi *, I have table with columns with these types: XML, varchar(MAX), nvarchar(MAX), varbinary(MAX) When I use dbtablecolinfo() I receive DBCOL structure with these MaxLength (or dbcollen()): 2147483647 (=2^31-1) 2147483647 2147483647 1073741823 (=2^30-1) I am wondering about varbinary(MAX), I would expect 2147483647 for them also. (as SQL Server documentation says, that maximum storage size is 2^31-1 bytes) Why is there 2^30-1 , is it okay? Thanks -Laco. Here is part of tds dump: token.c:1537:tds7_get_data_info: colname = xml_field type = 241 (xml) server's type = 241 (xml) column_varint_size = 8 column_size = 2147483647 (2147483647 on server) token.c:3148:adjust_character_column_size: Server charset: CP1250 Server column_size: 1073741823 Client charset: UTF-8 Client column_size: 2147483647 token.c:1537:tds7_get_data_info: colname = varcharmax_field type = 39 (varchar) server's type = 167 (xvarchar) column_varint_size = 8 column_size = 2147483647 (1073741823 on server) token.c:3148:adjust_character_column_size: Server charset: UCS-2LE Server column_size: 1073741823 Client charset: UTF-8 Client column_size: 2147483647 token.c:1537:tds7_get_data_info: colname = nvarcharmax_field type = 39 (varchar) server's type = 231 (x UCS-2 varchar) column_varint_size = 8 column_size = 2147483647 (1073741823 on server) token.c:1537:tds7_get_data_info: colname = varbinarymax_field type = 37 (varbinary) server's type = 165 (xvarbinary) column_varint_size = 8 column_size = 1073741823 (1073741823 on server) token.c:1609: name size/wsize type/wtype utype token.c:1610: -------------------- --------------- --------------- ------- token.c:1615: xml_field 2147483647/2147483647 241/241 0 token.c:1615: varcharmax_field 2147483647/1073741823 39/167 0 token.c:1615: nvarcharmax_field 2147483647/1073741823 39/231 0 token.c:1615: varbinarymax_field 1073741823/1073741823 37/165 0 From freddy77 at gmail.com Mon Mar 2 07:08:13 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 2 Mar 2015 12:08:13 +0000 Subject: [freetds] [PATCH] Handle empty char/varchar in bcp round trip (Re: bp with empty char/varchar column broken) In-Reply-To: <5C207B6E-D577-44D6-B17D-564BBA4DBB9E@mac.com> References: <2D7AEB19-038B-427C-B5F6-40BB7A389CE7@mac.com> <2FE95B42-7EA0-47EB-9D65-056C16C470CC@mac.com> <5C207B6E-D577-44D6-B17D-564BBA4DBB9E@mac.com> Message-ID: 2015-03-01 16:19 GMT+00:00 Craig A. Berry : > >> On Nov 21, 2014, at 9:43 AM, Craig A. Berry wrote: >> >> >>> On Nov 21, 2014, at 5:58 AM, Frediano Ziglio wrote: >>> >>> 2014-11-20 19:53 GMT+00:00 Craig A. Berry : >>>> The following worked in 0.91 but is broken as of branch-0_92-839-gd788046. If we bulk out a table with an empty (but not NULL) char or varchar column that is less than 256 bytes long, 256 spaces get written to the output file for that column. Which then causes an overflow error if you try to bulk it back in. >>> >> >>> Quite strange. Why does it happen only for empty strings? Should even >>> happen with small ones. The function has to pad or not based on type. >> >> The actual length of the string received on the wire is passed as the source length to dbconvert, and dbconvert (usually) uses that as its return value, and that return value is passed to fwrite for moving data to the file. >> >> But if the source length is zero, dbconvert uses the destination length as its return value as long as the destination length is greater than zero. Since it's now always 256, we get 256 spaces. >> >>> Actually is not clear to me what an empty column should look like in >>> the text bcp file. >> >> I'm pretty sure a zero-length column in a bcp file indicates NULL, and one or more spaces indicates empty string and will be trimmed on bulk in. > > I have studied this a bit more now. What the Microsoft client does consistently is output a single ASCII NUL to indicate an empty string in the database column and an empty string to indicate a database NULL. I don't have any Sybase clients to test with and I haven't found any documentation indicating how it works so I don't know if this is part of the BCP spec or just something Microsoft did. > NUL.... odd but true... why not a single space? NUL is terrible to handle, for instance using fgets with C you then cannot understand where the string terminate. I committed the patch. I would be curious to see what happen with TEXT/IMAGE and VARBINARY. For varbinary(1) for instance a single NUL byte is perfectly fine. Perhaps binaries in BCP files are stored as ASCII hexadecimal? > The attached patch modifies _bcp_exec_out and _bcp_read_hostfile so FreeTDS does the same thing Microsoft bcp does. Without this, we don't handle empty strings correctly round trip in bcp. > Good. Glad you changed also bcp test. Looking at test I'm wondering if this test is doing what it should. It seems it insert some data into a table but the test for data is mainly missing (it just print a select result on output without any check). I think t0016 is much better although is not complete either. The problem with t0016 is that it insert from bcp, dump from table and then check differences from inserted to extracted (which must be the same) but is not 100% sure on the table we have the data we want. Would be also nice if test could have even more than 2 rows. Frediano From freddy77 at gmail.com Mon Mar 2 08:13:33 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 2 Mar 2015 13:13:33 +0000 Subject: [freetds] varbinary(MAX) and DBCOL.MaxLength In-Reply-To: <54F40867.2080800@zoznam.sk> References: <54F40867.2080800@zoznam.sk> Message-ID: Il 02/Mar/2015 10:01 "LacaK" ha scritto: > > Hi *, > I have table with columns with these types: > XML, > varchar(MAX), > nvarchar(MAX), > varbinary(MAX) > When I use dbtablecolinfo() I receive DBCOL structure with these MaxLength (or dbcollen()): > 2147483647 (=2^31-1) > 2147483647 > 2147483647 > 1073741823 (=2^30-1) > I am wondering about varbinary(MAX), I would expect 2147483647 for them also. > (as SQL Server documentation says, that maximum storage size is 2^31-1 bytes) > Why is there 2^30-1 , is it okay? > Quite odd indeed. I would expect XML and nvarchar could be half not varbinary. Could be the conversion from hexadecimal to binary? I don't remember where these constants came. From server or just code I don't know. > Thanks > -Laco. > > Here is part of tds dump: > > token.c:1537:tds7_get_data_info: > colname = xml_field > type = 241 (xml) > server's type = 241 (xml) > column_varint_size = 8 > column_size = 2147483647 (2147483647 on server) > > token.c:3148:adjust_character_column_size: > Server charset: CP1250 > Server column_size: 1073741823 > Client charset: UTF-8 > Client column_size: 2147483647 > token.c:1537:tds7_get_data_info: > colname = varcharmax_field > type = 39 (varchar) > server's type = 167 (xvarchar) > column_varint_size = 8 > column_size = 2147483647 (1073741823 on server) > > token.c:3148:adjust_character_column_size: > Server charset: UCS-2LE > Server column_size: 1073741823 > Client charset: UTF-8 > Client column_size: 2147483647 > token.c:1537:tds7_get_data_info: > colname = nvarcharmax_field > type = 39 (varchar) > server's type = 231 (x UCS-2 varchar) > column_varint_size = 8 > column_size = 2147483647 (1073741823 on server) > > token.c:1537:tds7_get_data_info: > colname = varbinarymax_field > type = 37 (varbinary) > server's type = 165 (xvarbinary) > column_varint_size = 8 > column_size = 1073741823 (1073741823 on server) > > token.c:1609: name size/wsize type/wtype utype > token.c:1610: -------------------- --------------- --------------- ------- > token.c:1615: xml_field 2147483647/2147483647 241/241 0 > token.c:1615: varcharmax_field 2147483647/1073741823 39/167 0 > token.c:1615: nvarcharmax_field 2147483647/1073741823 39/231 0 > token.c:1615: varbinarymax_field 1073741823/1073741823 37/165 0 > Frediano From legrandmarc20 at hotmail.com Mon Mar 2 09:05:54 2015 From: legrandmarc20 at hotmail.com (=?iso-8859-1?B?TWFyYy1BbmRy6SBMZWdyYW5k?=) Date: Mon, 2 Mar 2015 15:05:54 +0100 Subject: [freetds] Looking up hostname from IP address and connection problem MS SQL Server from php In-Reply-To: References: , Message-ID: OK, If I understood well, I have to get the following configurations in these files : In /etc/odbc.ini script : ============================================================ [ODBC Data Sources] MyMSSQLServerName=MSSQL Server [MyMSSQLServerName] Driver = /usr/lib64/libtdsodbc.so.0 Description = MSSQL Server Trace = No Server = 192.168.1.32 Database = mydatabase Port = 1433 TDS_Version = 7.2 ============================================================ In /etc/odbcinst.ini file : ============================================================== # Example driver definitions # Driver from the postgresql-odbc package # Setup from the unixODBC package [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/psqlodbc.so Setup = /usr/lib/libodbcpsqlS.so Driver64 = /usr/lib64/psqlodbc.so Setup64 = /usr/lib64/libodbcpsqlS.so FileUsage = 1 # Driver from the mysql-connector-odbc package # Setup from the unixODBC package [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc5.so Setup = /usr/lib/libodbcmyS.so Driver64 = /usr/lib64/libmyodbc5.so Setup64 = /usr/lib64/libodbcmyS.so FileUsage = 1 [FreeTDS] Driver = /usr/lib64/libtdsodbc.so.0 Setup = /usr/lib64/libtdsS.so Description = MSSQL Server Trace = No ================================================================================ The /etc/freetds.conf file : ===================================================================== # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ # # This file is installed by FreeTDS if no file by the same # name is found in the installation directory. # # For information about the layout of this file and its settings, # see the freetds.conf manpage "man freetds.conf". # Global settings are overridden by those in a database # server specific section [global] # TDS protocol version ; tds version = 4.2 # Whether to write a TDSDUMP file for diagnostic purposes # (setting this to /tmp is insecure on a multi-user system) ; dump file = /tmp/freetds.log ; debug flags = 0xffff # Command and connection timeouts ; timeout = 10 ; connect timeout = 10 # If you get out-of-memory errors, it may mean that your client # is trying to allocate a huge buffer for a TEXT field. # Try setting 'text size' to a more reasonable limit text size = 64512 # A typical Sybase server [egServer50] host = symachine.domain.com port = 5000 tds version = 5.0 # A typical Microsoft server [egServer70] host = ntmachine.domain.com port = 1433 tds version = 7.0 ## I added theses lines below # MSSQL ServerName [MyMSSQLServerName] host = 192.168.1.32 port = 1433 tds version = 7.0 # client charset = UTF-8 =============================================================================================== > These 4 lines here are useless and confusing, odbcinst.ini is just for > drivers, not connections. OK. > It's better to set Setup for unixODBC with same value as Driver > (FreeTDS provide a Setup). I don't understand everything, could you give me an example how should I make the script in odbcinst.ini, odbc.ini and freetds.conf please ? > You should use DSN here to refer the entry you configured in odbc.ini. > Also you should try with isql tools to connect. > > Something like "DSN=MyMSSQLServerName;UID=user;PWD=password;" > replacing user and password. You need either to provide a > username/password or setup Kerberos. > In my case, the php file refers the odbcinst.ini. Can you tell me how could I must my php page refers to the odbc.ini configuration , if I should use : $dsn = "DSN=MyMSSQLServerName;UID=user;PWD=password;"; $cnx = odbc_connect($dsn,'',''); ? Sorry, I use the odbc connection and odbc functions (not php mssql functions) for my web server . I know nothing about Kerberos. The value of UID, is the authentication SQL Server login or Windows login ? Should I modify something in my MS Windows Server or SQL Server ? What should I do about this ? Thank you very mutch. Best regards. > Date: Sun, 1 Mar 2015 08:11:48 +0000 > From: freddy77 at gmail.com > To: freetds at lists.ibiblio.org > Subject: Re: [freetds] Looking up hostname from IP address and connection problem MS SQL Server from php > > 2015-02-27 14:14 GMT+00:00 Marc-Andr? Legrand : > > > > > > > > Hello, > > > > I installed FreeTDS on CentOS 6.6 and I have a connection problem between > > PHP Server and MS SQL Server 2014. I have the following message : > > Warning: odbc_connect(): SQL error: [unixODBC][FreeTDS][SQL Server]Unable to connect > > to data source, SQL state S1000 in SQLConnect > > After FreeTDS installation I made a test by : > > # tsql -C > > Compile-time settings (established with the "configure" script) > > Version: freetds v0.91 > > 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 > > SSPI "trusted" logins: no > > Kerberos: yes > > > > > > It is a FreeTDS RPM version that I have got . > > Here is Linux Server feature : > > CentOS 6.6 > > Php 5.3.3 > > Apache 2.2.15 > > unixodbc 2.2.14 > > freetds 0.91 > > My Windows Server : > > Windows Server 2012 R2 > > MS SQL Server 2014 Standard Edition > > Here is the command line that I executed : > > # osql -S MyMSSQLServerName -U user -P password > > > > My result of this command : > > checking shared odbc libraries linked to isql for default directories... > > strings: '': No such file > > trying /tmp/sqlH ... no > > trying /tmp/sqlL ... no > > trying /etc ... OK > > checking odbc.ini files > > cannot read "/root/.odbc.ini" > > reading /etc/odbc.ini > > [MyMSSQLServerName] found in /etc/odbc.ini > > found this section: > > [MyMSSQLServerName] > > Driver = /usr/lib64/libtdsodbc.so.0 > > Description = MSSQL Server > > Trace = No > > Server = 192.168.1.32 > > Database = mydatabase > > Port = 1433 > > TDS_Version = 7.2 > > > > looking for driver for DSN [MyMSSQLServerName] in /etc/odbc.ini > > found driver line: " Driver = /usr/lib64/libtdsodbc.so.0" > > driver "/usr/lib64/libtdsodbc.so.0" found for [MyMSSQLServerName] in odbc.ini > > found driver named "/usr/lib64/libtdsodbc.so.0" > > /usr/lib64/libtdsodbc.so.0 is an executable file > > "Server" found, not using freetds.conf > > Server is "192.168.1.32" > > looking up hostname for ip address 192.168.1.32 > > osql: warning: no DNS hostname found for "192.168.1.32" > > Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time] > > [-R number] [-m flag] hostname [server] > > -a is equivalent to -v -t ANY > > -c specifies query class for non-IN data > > -C compares SOA records on authoritative nameservers > > -d is equivalent to -v > > -l lists all hosts in a domain, using AXFR > > -i IP6.INT reverse lookups > > -N changes the number of dots allowed before root lookup is done > > -r disables recursive processing > > -R specifies number of retries for UDP packets > > -s a SERVFAIL response should stop query > > -t specifies the query type > > -T enables TCP/IP mode > > -v enables verbose output > > -w specifies to wait forever for a reply > > -W specifies how long to wait for a reply > > -4 use IPv4 query transport only > > -6 use IPv6 query transport only > > -m set memory debugging flag (trace|record|usage) > > osql: no IP address found for "" > > I think this is just a problem of osql, FreeTDS is able to use ip > directly in server. > > > > > Here is my ODBC configuration > > ==================================================================== > > /etc/odbc.ini for osql > > [ODBC Data Sources] > > MyMSSQLServerName=MSSQL Server > > [MyMSSQLServerName] > > Driver = /usr/lib64/libtdsodbc.so.0 > > Description = MSSQL Server > > Trace = No > > Server = 192.168.1.32 > > Database = mydatabase > > Port = 1433 > > TDS_Version = 7.2 > > Looks good > > > [Default] > > Driver=/usr/lib64/libtdsodbc.so.0 > > ================================================================ > > /etc/odbcinst.ini for php > > # Example driver definitions > > # Driver from the postgresql-odbc package > > # Setup from the unixODBC package > > [PostgreSQL] > > Description = ODBC for PostgreSQL > > Driver = /usr/lib/psqlodbc.so > > Setup = /usr/lib/libodbcpsqlS.so > > Driver64 = /usr/lib64/psqlodbc.so > > Setup64 = /usr/lib64/libodbcpsqlS.so > > FileUsage = 1 > > > > # Driver from the mysql-connector-odbc package > > # Setup from the unixODBC package > > [MySQL] > > Description = ODBC for MySQL > > Driver = /usr/lib/libmyodbc5.so > > Setup = /usr/lib/libodbcmyS.so > > Driver64 = /usr/lib64/libmyodbc5.so > > Setup64 = /usr/lib64/libodbcmyS.so > > FileUsage = 1 > > > > [FreeTDS] > > Driver = /usr/lib64/libtdsodbc.so.0 > > Setup = /usr/lib64/libtdsS.so > > Description = MSSQL Server > > Trace = No > > > Server = 192.168.1.32 > > Database = mydatabase > > Port = 1433 > > TDS_Version = 7.2 > > These 4 lines here are useless and confusing, odbcinst.ini is just for > drivers, not connections. > It's better to set Setup for unixODBC with same value as Driver > (FreeTDS provide a Setup). > > > ===================================================================== > > /etc/freetds.conf > > # $Id: freetds.conf,v 1.12 2007/12/25 06:02:36 jklowden Exp $ > > # > > # This file is installed by FreeTDS if no file by the same > > # name is found in the installation directory. > > # > > # For information about the layout of this file and its settings, > > # see the freetds.conf manpage "man freetds.conf". > > # Global settings are overridden by those in a database > > # server specific section > > [global] > > # TDS protocol version > > ; tds version = 4.2 > > # Whether to write a TDSDUMP file for diagnostic purposes > > # (setting this to /tmp is insecure on a multi-user system) > > ; dump file = /tmp/freetds.log > > ; debug flags = 0xffff > > # Command and connection timeouts > > ; timeout = 10 > > ; connect timeout = 10 > > > > # If you get out-of-memory errors, it may mean that your client > > # is trying to allocate a huge buffer for a TEXT field. > > # Try setting 'text size' to a more reasonable limit > > text size = 64512 > > # A typical Sybase server > > [egServer50] > > host = symachine.domain.com > > port = 5000 > > tds version = 5.0 > > # A typical Microsoft server > > [egServer70] > > host = ntmachine.domain.com > > port = 1433 > > tds version = 7.0 ## I added theses lines below > > # MSSQL ServerName > > [MyMSSQLServerName] > > host = 192.168.1.32 > > port = 1433 > > tds version = 7.0 > > # client charset = UTF-8 > > ==================================================================================== > > ======== > > > > My connection string in php file : > > Driver=FreeTDS;Server=192.168.1.32;Database=mydatabase; > > > > You should use DSN here to refer the entry you configured in odbc.ini. > Also you should try with isql tools to connect. > > Something like "DSN=MyMSSQLServerName;UID=user;PWD=password;" > replacing user and password. You need either to provide a > username/password or setup Kerberos. > > > Another information about CentOS, I disabled SELinux . > > The osql searches DNS hostname from the IP address that I given but it didn't find. > > > > I don't know if the connection problem from php to SQL Server is due by the lookup DNS problem from the IP address. > > > > I would like to know what should I do to resolve this connection problem ? > > > > Thank you for your response. > > > > Best regards. > > > > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds From matt.the.mech at gmail.com Mon Mar 2 12:33:07 2015 From: matt.the.mech at gmail.com (Matt Phipps) Date: Mon, 2 Mar 2015 12:33:07 -0500 Subject: [freetds] Table-Valued Parameters Message-ID: Hi FreeTDS, Does FreeTDS support calling procs with table-valued parameters? With either the ODBC driver or the DB-Library API? I think this is a SQL Server-specific feature introduced in SQL Server 2008. This page describes how to use table-valued parameters with ODBC: https://msdn.microsoft.com/en-us/library/bb522668(v=sql.100).aspx I didn't find any reference to SQL_SS_TABLE or "table-valued parameter" in the source for FreeTDS (or UnixODBC for that matter) so I assume that means table-valued parameters aren't supported. I've never used ODBC directly though so I might be missing something. I'm using FreeTDS 0.91 and UnixODBC 2.2.14 (the one used in Ubuntu 12.04). Thanks, Matt From cwthomas at llu.edu Tue Mar 3 11:45:19 2015 From: cwthomas at llu.edu (Thomas, Christopher (LLU)) Date: Tue, 3 Mar 2015 16:45:19 +0000 Subject: [freetds] Plans for PHP7 Message-ID: Hello, My organization uses PHP extensively to develop applications. I like to say we run a LAMP stack ... Linux Apache MSSQL and PHP :). Even though I can't write any C code, I always try to keep tabs on the development of PHP, FreeTDS and other technologies we need to do our jobs. Today I ran across the initiative (http://gophp7.org/gophp7-ext/ ) . Their goal it to get the extension writers to update their code for PHP7 before PHP7 ships. While looking around, it seems to me that the mssql extension has not been updated yet. It looks like it has been confirmed by https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts as it has been removed from the PHP code repository (master branch, but the latest release branch still has it so, mssql will not be in the next minor or major release). Is there any way that one of the FreeTDS maintainers can look at the MSSQL PHP extension and make sure it works with PHP7? Chris CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. If you have received this communication in error, please notify me immediately by replying to this message and destroy all copies of this communication and any attachments. Thank you. From freddy77 at gmail.com Tue Mar 3 13:39:22 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 3 Mar 2015 18:39:22 +0000 Subject: [freetds] Table-Valued Parameters In-Reply-To: References: Message-ID: 2015-03-02 17:33 GMT+00:00 Matt Phipps : > Hi FreeTDS, > > Does FreeTDS support calling procs with table-valued parameters? With > either the ODBC driver or the DB-Library API? I think this is a SQL > Server-specific feature introduced in SQL Server 2008. > > This page describes how to use table-valued parameters with ODBC: > https://msdn.microsoft.com/en-us/library/bb522668(v=sql.100).aspx I didn't > find any reference to SQL_SS_TABLE or "table-valued parameter" in the > source for FreeTDS (or UnixODBC for that matter) so I assume that means > table-valued parameters aren't supported. I've never used ODBC directly > though so I might be missing something. > > I'm using FreeTDS 0.91 and UnixODBC 2.2.14 (the one used in Ubuntu 12.04). > > Thanks, > Matt Hi, Currently is not implemented nor planned. You are first guy asking for this feature! Any help adding support for it is welcome. Regards, Frediano From freddy77 at gmail.com Tue Mar 3 13:45:15 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 3 Mar 2015 18:45:15 +0000 Subject: [freetds] Plans for PHP7 In-Reply-To: References: Message-ID: 2015-03-03 16:45 GMT+00:00 Thomas, Christopher (LLU) : > Hello, > > My organization uses PHP extensively to develop applications. I like to say we run a LAMP stack ... Linux Apache MSSQL and PHP :). Even though I can't write any C code, I always try to keep tabs on the development of PHP, FreeTDS and other technologies we need to do our jobs. Today I ran across the initiative (http://gophp7.org/gophp7-ext/ ) . Their goal it to get the extension writers to update their code for PHP7 before PHP7 ships. While looking around, it seems to me that the mssql extension has not been updated yet. It looks like it has been confirmed by https://wiki.php.net/rfc/removal_of_dead_sapis_and_exts as it has been removed from the PHP code repository (master branch, but the latest release branch still has it so, mssql will not be in the next minor or major release). Is there any way that one of the FreeTDS maintainers can look at the MSSQL PHP extension and make sure it works with PHP7? > > > Chris > No, there is no plan to support external software. However there are different extensions you can use that will be supported in PHP7 like pdo_dblib or odbc. You should probably convert your software to use these extensions or write some small wrapper in PHP7 to emulate old mssql extensions using another extension. Frediano From jorge at jorgechamorro.com Wed Mar 4 10:46:01 2015 From: jorge at jorgechamorro.com (Jorge Chamorro) Date: Wed, 4 Mar 2015 16:46:01 +0100 Subject: [freetds] GIT repository? Message-ID: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> Hi, Is there a git repository anywhere? One with all the history since day 1? Thank you, -- ( Jorge )(); From cwthomas at llu.edu Wed Mar 4 13:02:27 2015 From: cwthomas at llu.edu (Thomas, Christopher (LLU)) Date: Wed, 4 Mar 2015 18:02:27 +0000 Subject: [freetds] GIT repository? In-Reply-To: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> Message-ID: Try https://gitorious.org/freetds. It goes all the way back to 2001. Chris -----Original Message----- From: FreeTDS [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Jorge Chamorro Sent: Wednesday, March 04, 2015 7:46 AM To: FreeTDS Development Group Subject: [freetds] GIT repository? Hi, Is there a git repository anywhere? One with all the history since day 1? Thank you, -- ( Jorge )(); _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org http://lists.ibiblio.org/mailman/listinfo/freetds CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may contain confidential and privileged information for the use of the designated recipients named above. If you are not the intended recipient, you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it or its contents is prohibited. If you have received this communication in error, please notify me immediately by replying to this message and destroy all copies of this communication and any attachments. Thank you. From jorge at jorgechamorro.com Wed Mar 4 14:16:41 2015 From: jorge at jorgechamorro.com (Jorge) Date: Wed, 4 Mar 2015 20:16:41 +0100 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> Message-ID: On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: > Try https://gitorious.org/freetds. It goes all the way back to 2001. Thank you! (git cloned) But it won't compile: there's no ./configure and ./autogen.sh is giving me this: running /usr/bin/autoreconf in /Users/jorge/freetds: configure.ac:20: option `parallel-tests' not recognized autoreconf: automake failed with exit status: 1 glibtoolize: putting auxiliary files in `.'. glibtoolize: copying file `./ltmain.sh' glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'. glibtoolize: copying file `m4/libtool.m4' glibtoolize: copying file `m4/ltoptions.m4' glibtoolize: copying file `m4/ltsugar.m4' glibtoolize: copying file `m4/ltversion.m4' glibtoolize: copying file `m4/lt~obsolete.m4' glibtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT' configure.ac:20: option `parallel-tests' not recognized autoreconf: automake failed with exit status: 1 I'm running Snow Leopard/OSX 10.6.8. What can I do? $ libtool -V Apple Computer, Inc. version cctools-795 $ automake --version automake (GNU automake) 1.10 Written by Tom Tromey and Alexandre Duret-Lutz . Copyright 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ autoconf --version autoconf (GNU Autoconf) 2.61 Copyright (C) 2006 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License . There is NO WARRANTY, to the extent permitted by law. Written by David J. MacKenzie and Akim Demaille. Thanks, -- ( Jorge )(); From jorge at jorgechamorro.com Wed Mar 4 15:39:25 2015 From: jorge at jorgechamorro.com (Jorge Chamorro) Date: Wed, 4 Mar 2015 21:39:25 +0100 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> Message-ID: On 04/03/2015, at 20:16, Jorge wrote: > On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: > >> Try https://gitorious.org/freetds. It goes all the way back to 2001. > > Thank you! (git cloned) > > But it won't compile: there's no ./configure and ./autogen.sh is giving me this: > > running /usr/bin/autoreconf in /Users/jorge/freetds: > configure.ac:20: option `parallel-tests' not recognized > autoreconf: automake failed with exit status: 1 > glibtoolize: putting auxiliary files in `.'. > glibtoolize: copying file `./ltmain.sh' > glibtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'. > glibtoolize: copying file `m4/libtool.m4' > glibtoolize: copying file `m4/ltoptions.m4' > glibtoolize: copying file `m4/ltsugar.m4' > glibtoolize: copying file `m4/ltversion.m4' > glibtoolize: copying file `m4/lt~obsolete.m4' > glibtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT' > configure.ac:20: option `parallel-tests' not recognized > autoreconf: automake failed with exit status: 1 > > I'm running Snow Leopard/OSX 10.6.8. Ok, no problem. For the record: just removed the parallel-tests option in ./autogen.sh and it's compiling fine now: $ tsql -C Compile-time settings (established with the "configure" script) Version: freetds v0.92.dev.20150304 freetds.conf directory: /Users/jorge/binarios/etc MS db-lib source compatibility: no Sybase binary compatibility: no Thread safety: yes iconv library: yes TDS version: 7.1 iODBC: no unixodbc: no SSPI "trusted" logins: no Kerberos: no OpenSSL: yes GnuTLS: no Cool! -- ( Jorge )(); From jorge at jorgechamorro.com Wed Mar 4 16:08:27 2015 From: jorge at jorgechamorro.com (Jorge) Date: Wed, 4 Mar 2015 22:08:27 +0100 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> Message-ID: <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: > Try https://gitorious.org/freetds. It goes all the way back to 2001. BTW, I see "System notice: Gitorious is being acquired by GitLab and gitorious.org will shut down end of May", are you going to move it to gitlab or to github? -- ( Jorge )(); From jorge at jorgechamorro.com Wed Mar 4 16:39:41 2015 From: jorge at jorgechamorro.com (Jorge Chamorro) Date: Wed, 4 Mar 2015 22:39:41 +0100 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> Message-ID: <12AFE28C-2E5F-43A5-B59B-3507B843E8D5@jorgechamorro.com> On 04/03/2015, at 21:39, Jorge wrote: > On 04/03/2015, at 20:16, Jorge wrote: >> On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: >> >>> Try https://gitorious.org/freetds. It goes all the way back to 2001. >> >> Thank you! (git cloned) >> >> But it won't compile: there's no ./configure and ./autogen.sh is giving me this: >> >> I'm running Snow Leopard/OSX 10.6.8. > > Ok, no problem. For the record: just removed the parallel-tests option in ./autogen.sh and it's compiling fine now: I meant to say in configure.ac not in autogen.sh -- ( Jorge )(); From randy at thesyrings.us Wed Mar 4 16:11:09 2015 From: randy at thesyrings.us (Randy Syring) Date: Wed, 04 Mar 2015 16:11:09 -0500 Subject: [freetds] GIT repository? In-Reply-To: <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> Message-ID: <54F774ED.5080801@thesyrings.us> I'd highly recommend github. Your visibility and ease-of-engagement will increase by doing so. On some level, I know it seems like it shouldn't matter much. But, I really think it does. *Randy Syring* Husband | Father | Redeemed Sinner /"For what does it profit a man to gain the whole world and forfeit his soul?" (Mark 8:36 ESV)/ On 03/04/2015 04:08 PM, Jorge wrote: > On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: > >> Try https://gitorious.org/freetds. It goes all the way back to 2001. > BTW, I see "System notice: Gitorious is being acquired by GitLab and gitorious.org will shut down end of May", are you going to move it to gitlab or to github? > From a_wake at earthlink.net Wed Mar 4 16:46:23 2015 From: a_wake at earthlink.net (Andy Wakefield) Date: Wed, 04 Mar 2015 16:46:23 -0500 Subject: [freetds] subscribe Message-ID: <54F77D2F.6060100@earthlink.net> subscribe From msabramo at gmail.com Thu Mar 5 22:36:34 2015 From: msabramo at gmail.com (Marc Abramowitz) Date: Thu, 5 Mar 2015 19:36:34 -0800 Subject: [freetds] GIT repository? In-Reply-To: <54F774ED.5080801@thesyrings.us> References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> <54F774ED.5080801@thesyrings.us> Message-ID: Ditto the recommendation for GitHub unless you are boycotting GitHub or hate them for some particular reason. Most folks just feel more comfortable with GitHub. -Marc http://marc-abramowitz.com Sent from my iPhone 4S > On Mar 4, 2015, at 1:11 PM, Randy Syring wrote: > > I'd highly recommend github. Your visibility and ease-of-engagement will increase by doing so. On some level, I know it seems like it shouldn't matter much. But, I really think it does. > > *Randy Syring* > Husband | Father | Redeemed Sinner > > /"For what does it profit a man to gain the whole world > and forfeit his soul?" (Mark 8:36 ESV)/ > >> On 03/04/2015 04:08 PM, Jorge wrote: >>> On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: >>> >>> Try https://gitorious.org/freetds. It goes all the way back to 2001. >> BTW, I see "System notice: Gitorious is being acquired by GitLab and gitorious.org will shut down end of May", are you going to move it to gitlab or to github? > > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds From freddy77 at gmail.com Fri Mar 6 13:30:19 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 6 Mar 2015 18:30:19 +0000 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> <54F774ED.5080801@thesyrings.us> Message-ID: Hi Marc, nothing against GitHub. I saw your project on GitHub and I saw me and James are already owners. So why don't you switch the repository to be the mail one? It requires: 1- (me) make gitorious project read only (no commit no merge request) DONE; 2- (me/you, better you) make github writable (commit and merge enabled); 3- (me/you) change github project description; 4- (me) change gitorious project description; 5- (me) change links and documentation. Do you agree with the change? Could you do step 2 and 3? Regards, Frediano 2015-03-06 3:36 GMT+00:00 Marc Abramowitz : > Ditto the recommendation for GitHub unless you are boycotting GitHub or hate them for some particular reason. Most folks just feel more comfortable with GitHub. > > -Marc > http://marc-abramowitz.com > Sent from my iPhone 4S > > >> On Mar 4, 2015, at 1:11 PM, Randy Syring wrote: >> >> I'd highly recommend github. Your visibility and ease-of-engagement will increase by doing so. On some level, I know it seems like it shouldn't matter much. But, I really think it does. >> >> *Randy Syring* >> Husband | Father | Redeemed Sinner >> >> /"For what does it profit a man to gain the whole world >> and forfeit his soul?" (Mark 8:36 ESV)/ >> >>> On 03/04/2015 04:08 PM, Jorge wrote: >>>> On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: >>>> >>>> Try https://gitorious.org/freetds. It goes all the way back to 2001. >>> BTW, I see "System notice: Gitorious is being acquired by GitLab and gitorious.org will shut down end of May", are you going to move it to gitlab or to github? >> >> _______________________________________________ >> 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 From freddy77 at gmail.com Sat Mar 7 11:56:24 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sat, 7 Mar 2015 16:56:24 +0000 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> <54F774ED.5080801@thesyrings.us> Message-ID: Forget 2.1- (you) remove any script/hook/setting that copy from gitorious to github; 4.1- (me) point all snapshot creation to github Frediano 2015-03-06 18:30 GMT+00:00 Frediano Ziglio : > Hi Marc, > nothing against GitHub. I saw your project on GitHub and I saw me > and James are already owners. So why don't you switch the repository > to be the mail one? It requires: > 1- (me) make gitorious project read only (no commit no merge request) DONE; > 2- (me/you, better you) make github writable (commit and merge enabled); > 3- (me/you) change github project description; > 4- (me) change gitorious project description; > 5- (me) change links and documentation. > > Do you agree with the change? Could you do step 2 and 3? > > Regards, > Frediano > > > 2015-03-06 3:36 GMT+00:00 Marc Abramowitz : >> Ditto the recommendation for GitHub unless you are boycotting GitHub or hate them for some particular reason. Most folks just feel more comfortable with GitHub. >> >> -Marc >> http://marc-abramowitz.com >> Sent from my iPhone 4S >> >> >>> On Mar 4, 2015, at 1:11 PM, Randy Syring wrote: >>> >>> I'd highly recommend github. Your visibility and ease-of-engagement will increase by doing so. On some level, I know it seems like it shouldn't matter much. But, I really think it does. >>> >>> *Randy Syring* >>> Husband | Father | Redeemed Sinner >>> >>> /"For what does it profit a man to gain the whole world >>> and forfeit his soul?" (Mark 8:36 ESV)/ >>> >>>> On 03/04/2015 04:08 PM, Jorge wrote: >>>>> On 04/03/2015, at 19:02, Thomas, Christopher (LLU) wrote: >>>>> >>>>> Try https://gitorious.org/freetds. It goes all the way back to 2001. >>>> BTW, I see "System notice: Gitorious is being acquired by GitLab and gitorious.org will shut down end of May", are you going to move it to gitlab or to github? >>> >>> _______________________________________________ >>> 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 From victor_volpe at bol.com.br Sat Mar 7 12:52:50 2015 From: victor_volpe at bol.com.br (Victor Volpe) Date: Sat, 07 Mar 2015 14:52:50 -0300 Subject: [freetds] PHP CLI MSSQL crash Message-ID: <54fb3af2cdb2d_63d215b84e8df3e424580@a4-winter16.mail> Hi, the PHP script below are running fine in webserver but not in CLI. Maybe PHP are passing invalid pointers to the dbopen() function of FreeTDS. Ps.: No output in the FreeTDS debug file and the tsql are running fine. Submited to the PHP Bug Tracking System too: https://bugs.php.net/bug.php?id=69184 Any help will be appreciated. Test script: Actual result: (gdb) run test.php Starting program: /usr/bin/php test.php [New LWP 100886] [New Thread 808c06400 (LWP 100886/php)] Program received signal SIGBUS, Bus error. [Switching to Thread 808c06400 (LWP 100886/php)] 0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5 (gdb) bt #0 0x0000000801cc3f7a in dbopen () from /usr/local/lib/libsybdb.so.5 #1 0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5 #2 0x000000080635a1c1 in getpwent () from /lib/libc.so.7 #3 0x00000008063591b0 in getpwent_r () from /lib/libc.so.7 #4 0x000000080636ce2f in nsdispatch () from /lib/libc.so.7 #5 0x0000000806359c1e in getpwuid_r () from /lib/libc.so.7 #6 0x0000000801cd1978 in dbopen () from /usr/local/lib/libsybdb.so.5 #7 0x0000000801cc4cfd in dbopen () from /usr/local/lib/libsybdb.so.5 #8 0x0000000801cc3f85 in dbopen () from /usr/local/lib/libsybdb.so.5 #9 0x0000000801c9da97 in tdsdbopen () from /usr/local/lib/libsybdb.so.5 #10 0x00000000006c77df in php_mssql_do_connect () at php_mssql.c:793 #11 0x00000000008ca887 in zend_do_fcall_common_helper_SPEC (execute_data=0x808c42100) at zend_vm_execute.h:558 #12 0x0000000000889bf8 in execute_ex (execute_data=) at zend_vm_execute.h:363 #13 0x0000000000860da0 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:1341 #14 0x0000000000804f8c in php_execute_script (primary_file=0x7fffffffe868) at main.c:2578 #15 0x00000000008e6ccc in do_cli (argc=, argv=) at php_cli.c:994 #16 0x00000000008e59ba in main (argc=, argv=) at php_cli.c:1378 OS: FreeBSD 10.1-RELEASE-p6 PHP: 5.6.6 FreeTDS: 0.91.103_2,1 From fdsubs at t-online.hu Sat Mar 7 13:03:52 2015 From: fdsubs at t-online.hu (Daniel Fazekas) Date: Sat, 7 Mar 2015 19:03:52 +0100 Subject: [freetds] dblib assertion crash on connection timeouts Message-ID: <447071EC-BD1D-4220-96A0-16A4E72FF086@t-online.hu> I think it would be preferable if dblib in the current development version wouldn't just crash the host process with an assertion if a connection attempt times out. dbutil.c:193: _dblib_check_and_handle_interrupt: Assertion `dbproc != ((void *)0) && !dbdead((dbproc))' failed. For example, doing a bsqldb -S microsoft.com or trying any other firewalled or non-responsive address. Returning INT_CANCEL on DBDEAD in _dblib_check_and_handle_interrupt seems to be nicer. From msabramo at gmail.com Sun Mar 8 15:48:03 2015 From: msabramo at gmail.com (Marc Abramowitz) Date: Sun, 8 Mar 2015 12:48:03 -0700 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> <54F774ED.5080801@thesyrings.us> Message-ID: > On Mar 7, 2015, at 8:56 AM, Frediano Ziglio wrote: > > Forget > > 2.1- (you) remove any script/hook/setting that copy from gitorious to github; This is done. And IIRC, you are an owner of the GitHub repo so I think you can do whatever you need to do. If not, let me know and I'll try to help. From freddy77 at gmail.com Mon Mar 9 15:26:46 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 9 Mar 2015 19:26:46 +0000 Subject: [freetds] GIT repository? In-Reply-To: References: <3F48759E-9935-4233-9185-DD19FFB6209F@jorgechamorro.com> <387B96D6-1EA8-466F-9DA5-FE879E1FB03A@jorgechamorro.com> <54F774ED.5080801@thesyrings.us> Message-ID: So it's now all done! We are now on GitHub! Let's see tomorrow if snapshot is generated fine Frediano 2015-03-08 19:48 GMT+00:00 Marc Abramowitz : >> On Mar 7, 2015, at 8:56 AM, Frediano Ziglio wrote: >> >> Forget >> >> 2.1- (you) remove any script/hook/setting that copy from gitorious to github; > > This is done. And IIRC, you are an owner of the GitHub repo so I think you can do whatever you need to do. If not, let me know and I'll try to help. > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds From subhendu.ray at barclays.com Tue Mar 10 09:43:43 2015 From: subhendu.ray at barclays.com (subhendu.ray at barclays.com) Date: Tue, 10 Mar 2015 13:43:43 +0000 Subject: [freetds] setting the default database ("asa database") Message-ID: Hi Frediano, Please find the requested details below. Context: As per the freetds.conf documentation, 'ASA database' should set up the default database when connected to the database server instance. ASA database valid database name servername [section] name Specifies the name of the default database when connecting to an ASA server. A TDS 5.0 login packet has a field called lservname. For most TDS servers, lservname is a user-defined string with no inherent meaning. ASA servers, however, requires that lservname contain a valid database name, and sets that as the default database for the connection. FreeTDS normally fills lservname with the [section] text.. This entry instead sets the database name independently of the [section] name. Example of the freetds.conf: [FOOBAR_DEV] host = db_at_foo.fqdn.com instance = FOO_DEV_INSTANCE tds version = 7.0 asa database = BAR Problem: The default database was not set correctly when connected to "FOOBAR_DEV" DSN. Solution: Left file: src\tds\config#2.c Right file: src\tds\config#3.c } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) { < tds_dstr_copy(&connection->server_name, value); --- } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) { > tds_dstr_copy(&connection->database, value); There is another minor change suggested to make it obvious how we obtained the database during the setup phase; this is purely cosmetic. This can be ignored, if you like. Left file: src\tds\config#2.c Right file: src\tds\config#3.c 252c252 < tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "database", tds_dstr_cstr(&connection->database)); --- > tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "asa database", tds_dstr_cstr(&connection->database)); Please let me know if you need any more details. Thanks, Subhendu _______________________________________________ This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer. For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com. _______________________________________________ From freddy77 at gmail.com Tue Mar 10 12:03:27 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 10 Mar 2015 16:03:27 +0000 Subject: [freetds] setting the default database ("asa database") In-Reply-To: References: Message-ID: 2015-03-10 13:43 GMT+00:00 : > Hi Frediano, > > Please find the requested details below. > > > Context: > As per the freetds.conf documentation, 'ASA database' should set up the default database when connected to the database server instance. > ASA database valid database name servername [section] name Specifies the name of the default database when connecting to an ASA server. A TDS 5.0 login packet has a field called lservname. For most TDS servers, lservname is a user-defined string with no inherent meaning. ASA servers, however, requires that lservname contain a valid database name, and sets that as the default database for the connection. FreeTDS normally fills lservname with the [section] text.. This entry instead sets the database name independently of the [section] name. > > > Example of the freetds.conf: > [FOOBAR_DEV] > host = db_at_foo.fqdn.com > instance = FOO_DEV_INSTANCE > tds version = 7.0 > asa database = BAR > > Problem: The default database was not set correctly when connected to "FOOBAR_DEV" DSN. > > Solution: > Left file: src\tds\config#2.c > Right file: src\tds\config#3.c > } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) { > < tds_dstr_copy(&connection->server_name, value); > --- > } else if (!strcmp(option, TDS_STR_ASA_DATABASE)) { >> tds_dstr_copy(&connection->database, value); > > > > There is another minor change suggested to make it obvious how we obtained the database during the setup phase; this is purely cosmetic. This can be ignored, if you like. > Left file: src\tds\config#2.c > Right file: src\tds\config#3.c > 252c252 > < tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "database", tds_dstr_cstr(&connection->database)); > --- >> tdsdump_log(TDS_DBG_INFO1, "\t%20s = %s\n", "asa database", tds_dstr_cstr(&connection->database)); > > > > Please let me know if you need any more details. > > Thanks, > Subhendu > Unfortunately in this case documentation is not really clear as "database" terminology is used with two different meaning. ASA wants mainly that the server name in the login packet being the same as the one used during installation. So the "asa database" option replace server_name used to build login packet. Usually to set database field in the login structure you use different options provided by upper layer libraries. Frediano From subhendu.ray at barclays.com Wed Mar 11 04:50:00 2015 From: subhendu.ray at barclays.com (subhendu.ray at barclays.com) Date: Wed, 11 Mar 2015 08:50:00 +0000 Subject: [freetds] setting the default database ("asa database") Message-ID: Ah! I see now; my bad! Do you have any plan to support setting up the "default" database when the connection is made, may be via another parameter which can tds_dstr_copy(&connection->database, value) ? _______________________________________________ This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer. For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com. _______________________________________________ From cyreve at gmail.com Thu Mar 12 15:36:06 2015 From: cyreve at gmail.com (Richard Hughes) Date: Thu, 12 Mar 2015 19:36:06 +0000 Subject: [freetds] ODBC bcp Message-ID: <996340536.20150312193606@rhughes.net> Hi all, I wanted to be able to bulk copy into SQL Server from an ODBC application, so attached is my *work in progress* attempt at making this happen, for the purpose of early feedback about the approach. The only other attempt I can find at doing this was [0], which seemed extremely hacky and may have required significant code in the user application. My attempt tries to do it 'properly' and I've been testing it with an application which builds unaltered on both Windows and Linux. The patch steals a large amount of code from dblib/bcp.c but, in order to give myself an achievable goal, it implements *only* bcp in from RAM; all of the file I/O stuff has been ripped out. I believe this is a very sane and useful subset to have because my application does the bcp as one step of a single larger transaction and hence needs to use the existing ODBC connection. People wanting the file I/O bit probably don't have this constraint and hence can just use dblib or freebcp. A very useful document is [1] which lists the API differences from dblib. The most annoying is probably that all errors must go through SQLGetDiagRec rather than dblib's error handling, which is what necessitated so much copy-and-paste. A future task is to look at how this could be rationalized. The HDBC problem should be discussed. Because the driver manager has no idea about the bcp APIs, the first parameter that all the functions receive is a driver manager HDBC, not a TDS_DBC*. SQLGetInfo(SQL_DRIVER_HDBC) can be used to convert, but that means we need to find SQLGetInfo. Approaches I've thought of so far are: 1) dlopen(...,RTLD_NOLOAD) with various hard-coded filenames to try to find which driver manager the application is using 2) dl_iterate_phdr() to look for filenames that look like the driver manager [this is what's currently in the patch]. 3) dlsym(RTLD_DEFAULT,...). 4) Create a gratuitous libtdsodbcbcp.so containing just thunker functions whose sole purpose is to get out of the way of the default symbol search path so that method (3) works more reliably. Microsoft's Windows driver uses (1) because they know there's only one driver manager. (3) is subject to ordering problems with the symbol search, but those problems exist anyway at link time so I'm beginning to think that might be best. Richard. [0] http://lists.ibiblio.org/pipermail/freetds/2005q1/018076.html [1] https://msdn.microsoft.com/en-us/library/ms130924.aspx -------------- next part -------------- A non-text attachment was scrubbed... Name: freetds-odbc-bcp-1.patch.gz Type: application/octet-stream Size: 9760 bytes Desc: not available URL: From velichko.yuriy at gmail.com Fri Mar 13 10:09:25 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Fri, 13 Mar 2015 16:09:25 +0200 Subject: [freetds] How to connect via windows authentication? Message-ID: Hello! I can't figure out how to connect to SQL Server via windows auth using fretds library (dblib). In examples is shown how to connect via the SQL authentication. Is there example for windows auth. Should I change conf file, or set specific info to the LOGINREC for dbopen() ? From freddy77 at gmail.com Fri Mar 13 10:46:45 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 13 Mar 2015 14:46:45 +0000 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: 2015-03-13 14:09 GMT+00:00 Velichko Yuriy : > Hello! > > I can't figure out how to connect to SQL Server via windows auth using > fretds library (dblib). > > In examples is shown how to connect via the SQL authentication. > > Is there example for windows auth. > Should I change conf file, or set specific info to the LOGINREC for > dbopen() ? Hi, there are two way. Use domain username/password or use single sign on. To use domain username/password just specify the domain in your username. Something like "DOMAIN_NAME\\user_name" with your domain password. Could be that you have to use ntlm version 2 (see documentation). The other option is to use Kerberos or on Windows SSPI. The trick is to specify empty strings for username and password. SSPI is used (and available) on Windows and will use your logged on user while on any other machine you have to setup Kerberos and login (kinit usually) before launching your dblib application. Regards, Frediano From freddy77 at gmail.com Fri Mar 13 11:37:06 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 13 Mar 2015 15:37:06 +0000 Subject: [freetds] ODBC bcp In-Reply-To: <996340536.20150312193606@rhughes.net> References: <996340536.20150312193606@rhughes.net> Message-ID: 2015-03-12 19:36 GMT+00:00 Richard Hughes : > Hi all, > > I wanted to be able to bulk copy into SQL Server from an ODBC > application, so attached is my *work in progress* attempt at making > this happen, for the purpose of early feedback about the approach. > Very interesting project! I thought about sometimes but never had a practical reason to do it! > The only other attempt I can find at doing this was [0], which seemed > extremely hacky and may have required significant code in the user > application. My attempt tries to do it 'properly' and I've been > testing it with an application which builds unaltered on both Windows > and Linux. > Yes, I agree too, no change to user application (beside perhaps some include and obviously tools changed). > The patch steals a large amount of code from dblib/bcp.c but, in > order to give myself an achievable goal, it implements *only* bcp in > from RAM; all of the file I/O stuff has been ripped out. I believe > this is a very sane and useful subset to have because my application > does the bcp as one step of a single larger transaction and hence > needs to use the existing ODBC connection. People wanting the file I/O > bit probably don't have this constraint and hence can just use dblib > or freebcp. > > A very useful document is [1] which lists the API differences from > dblib. The most annoying is probably that all errors must go through > SQLGetDiagRec rather than dblib's error handling, which is what > necessitated so much copy-and-paste. A future task is to look at how > this could be rationalized. > Yes, coy and paste is not that great. I'm changing actually bcp.c (dblib) to use tds_convert instead of dbconvert. This could help moving code to libTDS (the common part) so we can reuse it. I remember was a nightmare extracting code from either dblib and ctlib in libTDS I don't want to do it again for dblib/odbc :) Well... probably using tdserror instead of dbperror could be a way. libTDS use callbacks and even for normal errors from network if calls these callbacks. In odbc these callbacks store errors in statement/connection to be retrieved by SQLGetDiagRec. I noted that bcp.c (used objdump) calls very few dblib functions (dbconvert, dbvarylen, dbperror and another I don't remember now) so I don't think will be much effort to move to libTDS. In bulk.c or another file. > The HDBC problem should be discussed. Because the driver manager has > no idea about the bcp APIs, the first parameter that all the functions > receive is a driver manager HDBC, not a TDS_DBC*. > SQLGetInfo(SQL_DRIVER_HDBC) can be used to convert, but that means we > need to find SQLGetInfo. Approaches I've thought of so far are: > > 1) dlopen(...,RTLD_NOLOAD) with various hard-coded filenames to try to > find which driver manager the application is using > > 2) dl_iterate_phdr() to look for filenames that look like the driver > manager [this is what's currently in the patch]. > > 3) dlsym(RTLD_DEFAULT,...). > > 4) Create a gratuitous libtdsodbcbcp.so containing just thunker > functions whose sole purpose is to get out of the way of the default > symbol search path so that method (3) works more reliably. > > Microsoft's Windows driver uses (1) because they know there's only one > driver manager. (3) is subject to ordering problems with the symbol > search, but those problems exist anyway at link time so I'm beginning > to think that might be best. > (3) should be fine as odbc drivers (like our one) should be loaded with RTLD_LOCAL flag so the SQLGetInfo from our driver is not found with RTLD_DEFAULT. Another idea would be to use a sort of "tunnel" using functions like SQLSetConnectAttr. Practically let's say we want to implement bcp_collen, we do something like typedef struct { DBINT cbData; INT idxServerCol; } bcp_collen_params; RETCODE bcp_collen ( HDBC hdbc, DBINT cbData, INT idxServerCol) { bcp_collen_params params = { cbData, idxServerCol }; return SQLSetConnectAttr(hdbc, SQL_SS_FUNC_BCP_COLLEN, ¶ms, sizeof(params)); } and FreeTDS code detect the willing to use bcp_collen and call tdsodbc_bcp_collen according. This way you solve having to get proper HDBC (driver one) and resolving tdsodbc_bcp_collen. Consider also that driver could be unloaded and loaded in another position but this way is you don't have to cache a pointer to tdsodbc_bcp_collen to make it faster the call. Yes, you have to marshal and unmarshal the parameters. > Richard. > > [0] http://lists.ibiblio.org/pipermail/freetds/2005q1/018076.html > [1] https://msdn.microsoft.com/en-us/library/ms130924.aspx Frediano From james.k.lowden at icloud.com Fri Mar 13 20:02:29 2015 From: james.k.lowden at icloud.com (James K. Lowden) Date: Fri, 13 Mar 2015 20:02:29 -0400 Subject: [freetds] ODBC bcp In-Reply-To: <996340536.20150312193606@rhughes.net> References: <996340536.20150312193606@rhughes.net> Message-ID: <20150313200229.f65d3974.james.k.lowden@icloud.com> On Thu, 12 Mar 2015 19:36:06 +0000 Richard Hughes wrote: > The HDBC problem should be discussed. Because the driver manager has > no idea about the bcp APIs, the first parameter that all the functions > receive is a driver manager HDBC, not a TDS_DBC*. Hi Richard, Like Frediano, I often wanted to add bcp to ODBC, but never really needed to. I'm glad to see someone tackle it. :-) I don't see the difficulty in quite the same way you do. You have a valid HDBC. It's connected. There's no rule that says (1) FreeTDS has to do what Microsoft did, or (2) that the DM has to know about every function supplied by the driver. Because dlopen has already been called, all driver functions, including any nonstandard functions, are already linked in. I think what you really need is the DM's handle to the loaded driver, i.e. the handle returned by dlopen(2). If there's no function to return that, I'd talk it over with the unixODBC folks and see if some sensible approach doesn't suggest itself. Either way, I'd hack the DM to get the handle, map in the functions, and away we go. BTW, this link looks useful if you haven't already seen it: https://msdn.microsoft.com/en-us/library/ms130924.aspx Finally, as a technical matter it's never been clear to me that the db-lib functions couldn't be used in situ. Why not have the ODBC driver call db-lib? You could construct a fake DBPROCESS structure for it with the connected socket already in place. Each ODBC call would map to a db-lib call using the contructed "db-lib connection" using err and msg handlers to compose buffers to supply to SQLGetDiagRec. Most of your work would be to write a "bcp application" in the ODBC driver (and map that application onto the ODBC bcp functions). The only db-lib change would be the magic of the ODBC bcp_init that would construct a DBPROCESS ab initio from a live, connnected HDBC. The advantages of using db-lib to support ODBC in this way are more important than any asthetic software-architecture concerns. The bcp code works very well, and would hardly be changed. The behavior of both libraries is near identical, and freebcp exercises exactly the same code that ODBC does. The bcp part of the TDS protocol is fiddly, and if you get it wrong you'll be unceremoniously disconnected. Really. No cerermony at all! And propagating the errors is both important and a bit tedious. Both those would make me hesititate to start moving bcp into libtds. It's only software; anything is possible. Depending on how much time you want to put in and what you want to get out of it, either choice is viable. Just wanted to mention another possibility. Regards, --jkl From velichko.yuriy at gmail.com Fri Mar 13 11:03:31 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Fri, 13 Mar 2015 17:03:31 +0200 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: Thanks! The first approach works fine. I saw it before but forgot to duplicate '\' symbol in the user name, so got an error, very shamefully. ) Second approach needs more time to realisation but I'm sure that I can implement it too. Thanks for the quick answer. Very helpful. On 13 March 2015 at 16:46, Frediano Ziglio wrote: > 2015-03-13 14:09 GMT+00:00 Velichko Yuriy : > > Hello! > > > > I can't figure out how to connect to SQL Server via windows auth using > > fretds library (dblib). > > > > In examples is shown how to connect via the SQL authentication. > > > > Is there example for windows auth. > > Should I change conf file, or set specific info to the LOGINREC for > > dbopen() ? > > Hi, > there are two way. Use domain username/password or use single sign on. > > To use domain username/password just specify the domain in your > username. Something like "DOMAIN_NAME\\user_name" with your domain > password. Could be that you have to use ntlm version 2 (see > documentation). > > The other option is to use Kerberos or on Windows SSPI. The trick is > to specify empty strings for username and password. SSPI is used (and > available) on Windows and will use your logged on user while on any > other machine you have to setup Kerberos and login (kinit usually) > before launching your dblib application. > > Regards, > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > -- ?? ?????????, ??????? ????. From cyreve at gmail.com Fri Mar 13 17:09:08 2015 From: cyreve at gmail.com (Richard Hughes) Date: Fri, 13 Mar 2015 21:09:08 +0000 Subject: [freetds] ODBC bcp In-Reply-To: References: <996340536.20150312193606@rhughes.net> Message-ID: <6910288090.20150313210908@rhughes.net> On 2015-03-13 at 15:37, Frediano Ziglio wrote: > 2015-03-12 19:36 GMT+00:00 Richard Hughes : >> The patch steals a large amount of code from dblib/bcp.c but, in >> order to give myself an achievable goal, it implements *only* bcp in >> from RAM; all of the file I/O stuff has been ripped out. I believe >> this is a very sane and useful subset to have because my application >> does the bcp as one step of a single larger transaction and hence >> needs to use the existing ODBC connection. People wanting the file I/O >> bit probably don't have this constraint and hence can just use dblib >> or freebcp. >> >> A very useful document is [1] which lists the API differences from >> dblib. The most annoying is probably that all errors must go through >> SQLGetDiagRec rather than dblib's error handling, which is what >> necessitated so much copy-and-paste. A future task is to look at how >> this could be rationalized. > Yes, coy and paste is not that great. I'm changing actually bcp.c > (dblib) to use tds_convert instead of dbconvert. This could help > moving code to libTDS (the common part) so we can reuse it. I remember > was a nightmare extracting code from either dblib and ctlib in libTDS > I don't want to do it again for dblib/odbc :) I've been looking at the conversion code today and the only conclusion I've reached is that everything I did is wrong. I now assume that I should have used odbc_sql2tds() as my template but that's full of ipd/apd handling that bcp simply doesn't have. Since the first bug I noticed involved nvarchar, I was trying to figure out how the character set conversion was supposed to work and now I'm more lost than when I started. Hopefully everything except the datetime2/numeric conversion can be put into libTDS, but I'm neither knowledgeable enough nor skilled enough to be able to participate in an architectural discussion. If you tell me what you're planning to work on and what you need me to change then I'll happily do as I'm told. In the mean time I've got a lot of tests to write. > Well... probably using tdserror instead of dbperror could be a way. > libTDS use callbacks and even for normal errors from network if calls > these callbacks. In odbc these callbacks store errors in > statement/connection to be retrieved by SQLGetDiagRec. I noted that > bcp.c (used objdump) calls very few dblib functions (dbconvert, > dbvarylen, dbperror and another I don't remember now) so I don't think > will be much effort to move to libTDS. In bulk.c or another file. Again, if you can divide up the work and tell me which bits you're working on and which bits I should do then I can get started with a minimum of merge conflicts. We might even get file I/O out of it this way (although those BCPFILECP and BCPUNICODEFILE options look scary). Remember to keep a browser tab with the API differences [1] open while looking at what code can/should be shared. >> The HDBC problem should be discussed. Because the driver manager has >> no idea about the bcp APIs, the first parameter that all the functions >> receive is a driver manager HDBC, not a TDS_DBC*. >> SQLGetInfo(SQL_DRIVER_HDBC) can be used to convert, but that means we >> need to find SQLGetInfo. Approaches I've thought of so far are: >> >> 1) dlopen(...,RTLD_NOLOAD) with various hard-coded filenames to try to >> find which driver manager the application is using >> >> 2) dl_iterate_phdr() to look for filenames that look like the driver >> manager [this is what's currently in the patch]. >> >> 3) dlsym(RTLD_DEFAULT,...). >> >> 4) Create a gratuitous libtdsodbcbcp.so containing just thunker >> functions whose sole purpose is to get out of the way of the default >> symbol search path so that method (3) works more reliably. >> >> Microsoft's Windows driver uses (1) because they know there's only one >> driver manager. (3) is subject to ordering problems with the symbol >> search, but those problems exist anyway at link time so I'm beginning >> to think that might be best. >> > (3) should be fine as odbc drivers (like our one) should be loaded > with RTLD_LOCAL flag so the SQLGetInfo from our driver is not found > with RTLD_DEFAULT. > > Another idea would be to use a sort of "tunnel" using functions like > SQLSetConnectAttr. Practically let's say we want to implement > bcp_collen, we do something like > > typedef struct { > DBINT cbData; > INT idxServerCol; > } bcp_collen_params; > > RETCODE bcp_collen ( > HDBC hdbc, > DBINT cbData, > INT idxServerCol) > { > bcp_collen_params params = { cbData, idxServerCol }; > return SQLSetConnectAttr(hdbc, SQL_SS_FUNC_BCP_COLLEN, ¶ms, > sizeof(params)); > } This actually doesn't solve the problem. That call to SQLSetConnectAttr() will bind to the one in odbc.c, not the one in the driver manager - it's the same problem as trying to call SQLGetInfo() directly. I'll go with my option (3). It has the surprising property that if you link with "gcc -ltdsodbc -lodbc" then you'll bind directly to FreeTDS and be confused that attempting to use any other driver doesn't work, but we'll just have to document that you must use "gcc -lodbc -ltdsodbc". Richard. >> [1] https://msdn.microsoft.com/en-us/library/ms130924.aspx From velichko.yuriy at gmail.com Fri Mar 13 19:06:06 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Sat, 14 Mar 2015 01:06:06 +0200 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: A little question about Windows SSPI auth. My app uses db-lib. The SQL server and app works on the same machine (win 8.1, SQLServer EXPRESS 12) conf file: host = localhost port = 1433 connect timeout = 0 tds version = ?7? .0 use ntlmv2 = yes client charset = UTF-8 ?Code to connect:? dberrhandle( ...); dbmsghandle( ... ); DBSETLUSER( login, "" ); DBSETLPWD( login,"" ); DBPROCESS* conn = dbopen( login, my_app" ); if( conn ) { } else { <<<< Goes here } On 13 March 2015 at 17:03, Velichko Yuriy wrote: > Thanks! > > The first approach works fine. I saw it before but forgot to duplicate '\' > symbol in the user name, so got an error, very shamefully. ) > > Second approach needs more time to realisation but I'm sure that I can > implement it too. > > Thanks for the quick answer. Very helpful. > > On 13 March 2015 at 16:46, Frediano Ziglio wrote: > >> 2015-03-13 14:09 GMT+00:00 Velichko Yuriy : >> > Hello! >> > >> > I can't figure out how to connect to SQL Server via windows auth using >> > fretds library (dblib). >> > >> > In examples is shown how to connect via the SQL authentication. >> > >> > Is there example for windows auth. >> > Should I change conf file, or set specific info to the LOGINREC for >> > dbopen() ? >> >> Hi, >> there are two way. Use domain username/password or use single sign on. >> >> To use domain username/password just specify the domain in your >> username. Something like "DOMAIN_NAME\\user_name" with your domain >> password. Could be that you have to use ntlm version 2 (see >> documentation). >> >> The other option is to use Kerberos or on Windows SSPI. The trick is >> to specify empty strings for username and password. SSPI is used (and >> available) on Windows and will use your logged on user while on any >> other machine you have to setup Kerberos and login (kinit usually) >> before launching your dblib application. >> >> Regards, >> Frediano >> _______________________________________________ >> FreeTDS mailing list >> FreeTDS at lists.ibiblio.org >> http://lists.ibiblio.org/mailman/listinfo/freetds >> > > > > -- > ?? ?????????, ??????? ????. > -- ?? ?????????, ??????? ????. From velichko.yuriy at gmail.com Fri Mar 13 19:16:58 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Sat, 14 Mar 2015 01:16:58 +0200 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: Sorry - miss-click. in result DBPROCESS is NULL. I try to debug what happens in dbopen, and figure out tat connection established properly. Problem in function tds_goodread() for stack: > vs_plugin_db_mssql.dll!tds_goodread(tds_socket * tds, unsigned char * buf, int buflen, unsigned char unfinished) Line 437 C vs_plugin_db_mssql.dll!goodread(tds_socket * tds, unsigned char * buf, int buflen) Line 504 C vs_plugin_db_mssql.dll!tds_read_packet(tds_socket * tds) Line 530 C vs_plugin_db_mssql.dll!tds_get_byte(tds_socket * tds) Line 73 C vs_plugin_db_mssql.dll!tds_process_login_tokens(tds_socket * tds) Line 336 C vs_plugin_db_mssql.dll!tds_connect(tds_socket * tds, tds_connection * connection, int * p_oserr) Line 469 C vs_plugin_db_mssql.dll!tds_connect_and_login(tds_socket * tds, tds_connection * connection) Line 510 C vs_plugin_db_mssql.dll!tdsdbopen(tds_dblib_loginrec * login, const char * server, int msdblib) Line 1232 C Maybe I forgot some params for connection? On 14 March 2015 at 01:06, Velichko Yuriy wrote: > A little question about Windows SSPI auth. > My app uses db-lib. The SQL server and app works on the same machine (win > 8.1, SQLServer EXPRESS 12) > > conf file: > > host = localhost > port = 1433 > connect timeout = 0 > tds version = > ?7? > .0 > use ntlmv2 = yes > client charset = UTF-8 > > ?Code to connect:? > > dberrhandle( ...); > dbmsghandle( ... ); > > DBSETLUSER( login, "" ); > DBSETLPWD( login,"" ); > > DBPROCESS* conn = dbopen( login, my_app" ); > if( conn ) > { > > } > else > { > <<<< Goes here > } > > > > > On 13 March 2015 at 17:03, Velichko Yuriy > wrote: > >> Thanks! >> >> The first approach works fine. I saw it before but forgot to duplicate >> '\' symbol in the user name, so got an error, very shamefully. ) >> >> Second approach needs more time to realisation but I'm sure that I can >> implement it too. >> >> Thanks for the quick answer. Very helpful. >> >> On 13 March 2015 at 16:46, Frediano Ziglio wrote: >> >>> 2015-03-13 14:09 GMT+00:00 Velichko Yuriy : >>> > Hello! >>> > >>> > I can't figure out how to connect to SQL Server via windows auth using >>> > fretds library (dblib). >>> > >>> > In examples is shown how to connect via the SQL authentication. >>> > >>> > Is there example for windows auth. >>> > Should I change conf file, or set specific info to the LOGINREC for >>> > dbopen() ? >>> >>> Hi, >>> there are two way. Use domain username/password or use single sign on. >>> >>> To use domain username/password just specify the domain in your >>> username. Something like "DOMAIN_NAME\\user_name" with your domain >>> password. Could be that you have to use ntlm version 2 (see >>> documentation). >>> >>> The other option is to use Kerberos or on Windows SSPI. The trick is >>> to specify empty strings for username and password. SSPI is used (and >>> available) on Windows and will use your logged on user while on any >>> other machine you have to setup Kerberos and login (kinit usually) >>> before launching your dblib application. >>> >>> Regards, >>> Frediano >>> _______________________________________________ >>> FreeTDS mailing list >>> FreeTDS at lists.ibiblio.org >>> http://lists.ibiblio.org/mailman/listinfo/freetds >>> >> >> >> >> -- >> ?? ?????????, ??????? ????. >> > > > > -- > ?? ?????????, ??????? ????. > -- ?? ?????????, ??????? ????. From velichko.yuriy at gmail.com Fri Mar 13 19:32:57 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Sat, 14 Mar 2015 01:32:57 +0200 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: The function status = sec_fn->InitializeSecurityContext(&auth->cred, &auth->cred_ctx, auth->sname, ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION, 0, SECURITY_NETWORK_DREP, &in_desc, 0, &auth->cred_ctx, &out_desc, &attrs, &ts); return bad value for my case if (status != SEC_E_OK) return TDS_FAIL; Sorry for such spam. I'll be grateful if somebody can help me to figure out the problem of connection establishing On 14 March 2015 at 01:16, Velichko Yuriy wrote: > Sorry - miss-click. > > in result DBPROCESS is NULL. > > I try to debug what happens in dbopen, and figure out tat connection > established properly. > Problem in function tds_goodread() for stack: > > > vs_plugin_db_mssql.dll!tds_goodread(tds_socket * tds, unsigned char * > buf, int buflen, unsigned char unfinished) Line 437 C > vs_plugin_db_mssql.dll!goodread(tds_socket * tds, unsigned char * buf, > int buflen) Line 504 C > vs_plugin_db_mssql.dll!tds_read_packet(tds_socket * tds) Line 530 C > vs_plugin_db_mssql.dll!tds_get_byte(tds_socket * tds) Line 73 C > vs_plugin_db_mssql.dll!tds_process_login_tokens(tds_socket * tds) Line > 336 C > vs_plugin_db_mssql.dll!tds_connect(tds_socket * tds, tds_connection * > connection, int * p_oserr) Line 469 C > vs_plugin_db_mssql.dll!tds_connect_and_login(tds_socket * tds, > tds_connection * connection) Line 510 C > vs_plugin_db_mssql.dll!tdsdbopen(tds_dblib_loginrec * login, const char > * server, int msdblib) Line 1232 C > > Maybe I forgot some params for connection? > > On 14 March 2015 at 01:06, Velichko Yuriy > wrote: > >> A little question about Windows SSPI auth. >> My app uses db-lib. The SQL server and app works on the same machine (win >> 8.1, SQLServer EXPRESS 12) >> >> conf file: >> >> host = localhost >> port = 1433 >> connect timeout = 0 >> tds version = >> ?7? >> .0 >> use ntlmv2 = yes >> client charset = UTF-8 >> >> ?Code to connect:? >> >> dberrhandle( ...); >> dbmsghandle( ... ); >> >> DBSETLUSER( login, "" ); >> DBSETLPWD( login,"" ); >> >> DBPROCESS* conn = dbopen( login, my_app" ); >> if( conn ) >> { >> >> } >> else >> { >> <<<< Goes here >> } >> >> >> >> >> On 13 March 2015 at 17:03, Velichko Yuriy >> wrote: >> >>> Thanks! >>> >>> The first approach works fine. I saw it before but forgot to duplicate >>> '\' symbol in the user name, so got an error, very shamefully. ) >>> >>> Second approach needs more time to realisation but I'm sure that I can >>> implement it too. >>> >>> Thanks for the quick answer. Very helpful. >>> >>> On 13 March 2015 at 16:46, Frediano Ziglio wrote: >>> >>>> 2015-03-13 14:09 GMT+00:00 Velichko Yuriy : >>>> > Hello! >>>> > >>>> > I can't figure out how to connect to SQL Server via windows auth using >>>> > fretds library (dblib). >>>> > >>>> > In examples is shown how to connect via the SQL authentication. >>>> > >>>> > Is there example for windows auth. >>>> > Should I change conf file, or set specific info to the LOGINREC for >>>> > dbopen() ? >>>> >>>> Hi, >>>> there are two way. Use domain username/password or use single sign on. >>>> >>>> To use domain username/password just specify the domain in your >>>> username. Something like "DOMAIN_NAME\\user_name" with your domain >>>> password. Could be that you have to use ntlm version 2 (see >>>> documentation). >>>> >>>> The other option is to use Kerberos or on Windows SSPI. The trick is >>>> to specify empty strings for username and password. SSPI is used (and >>>> available) on Windows and will use your logged on user while on any >>>> other machine you have to setup Kerberos and login (kinit usually) >>>> before launching your dblib application. >>>> >>>> Regards, >>>> Frediano >>>> _______________________________________________ >>>> FreeTDS mailing list >>>> FreeTDS at lists.ibiblio.org >>>> http://lists.ibiblio.org/mailman/listinfo/freetds >>>> >>> >>> >>> >>> -- >>> ?? ?????????, ??????? ????. >>> >> >> >> >> -- >> ?? ?????????, ??????? ????. >> > > > > -- > ?? ?????????, ??????? ????. > -- ?? ?????????, ??????? ????. From freddy77 at gmail.com Sun Mar 15 07:46:08 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sun, 15 Mar 2015 11:46:08 +0000 Subject: [freetds] ODBC bcp In-Reply-To: <6910288090.20150313210908@rhughes.net> References: <996340536.20150312193606@rhughes.net> <6910288090.20150313210908@rhughes.net> Message-ID: 2015-03-13 21:09 GMT+00:00 Richard Hughes : > On 2015-03-13 at 15:37, Frediano Ziglio wrote: >> 2015-03-12 19:36 GMT+00:00 Richard Hughes : >>> The patch steals a large amount of code from dblib/bcp.c but, in >>> order to give myself an achievable goal, it implements *only* bcp in >>> from RAM; all of the file I/O stuff has been ripped out. I believe >>> this is a very sane and useful subset to have because my application >>> does the bcp as one step of a single larger transaction and hence >>> needs to use the existing ODBC connection. People wanting the file I/O >>> bit probably don't have this constraint and hence can just use dblib >>> or freebcp. >>> >>> A very useful document is [1] which lists the API differences from >>> dblib. The most annoying is probably that all errors must go through >>> SQLGetDiagRec rather than dblib's error handling, which is what >>> necessitated so much copy-and-paste. A future task is to look at how >>> this could be rationalized. > >> Yes, coy and paste is not that great. I'm changing actually bcp.c >> (dblib) to use tds_convert instead of dbconvert. This could help >> moving code to libTDS (the common part) so we can reuse it. I remember >> was a nightmare extracting code from either dblib and ctlib in libTDS >> I don't want to do it again for dblib/odbc :) > > I've been looking at the conversion code today and the only conclusion > I've reached is that everything I did is wrong. I now assume that I > should have used odbc_sql2tds() as my template but that's full of > ipd/apd handling that bcp simply doesn't have. Since the first bug I > noticed involved nvarchar, I was trying to figure out how the > character set conversion was supposed to work and now I'm more lost > than when I started. > Perhaps I was too direct. I don't think what you did is wrong. First bcp support is quite strange in ODBC. First is a sql server only extension on a quite standard API. Second it use types more similar to dblib than ODBC. Looks like Microsoft copied bcp source into ODBC so you did actually the same. Nothing wrong in it. I don't know actually how MS handle nvarchar in bcp code. We can surely help with conversions. Perhaps you should focus on a problem at a time, you are starting solving too much stuff altogether. Any temporary hacky solution is fine. Copy/paste, including bcp.c from odbc and redefining some functions or whatever is also fine. > Hopefully everything except the datetime2/numeric conversion can be > put into libTDS, but I'm neither knowledgeable enough nor skilled > enough to be able to participate in an architectural discussion. If > you tell me what you're planning to work on and what you need me to > change then I'll happily do as I'm told. In the mean time I've got a > lot of tests to write. > Good, tests are always good. You can have a look at dblib t0016 and t0017 tests just to get some code to copy/paste. What the problem with datetime2/numeric ? >> Well... probably using tdserror instead of dbperror could be a way. >> libTDS use callbacks and even for normal errors from network if calls >> these callbacks. In odbc these callbacks store errors in >> statement/connection to be retrieved by SQLGetDiagRec. I noted that >> bcp.c (used objdump) calls very few dblib functions (dbconvert, >> dbvarylen, dbperror and another I don't remember now) so I don't think >> will be much effort to move to libTDS. In bulk.c or another file. > > Again, if you can divide up the work and tell me which bits you're > working on and which bits I should do then I can get started with a > minimum of merge conflicts. We might even get file I/O out of it this > way (although those BCPFILECP and BCPUNICODEFILE options look scary). > Remember to keep a browser tab with the API differences [1] open while > looking at what code can/should be shared. > I'm looking at bcp code from different point, not to move it to libTDS. I'm closing some issue I want for a new release (see https://trello.com/b/bk0UZNRJ/freetds-todo-list) but we can implement bcp in another branch and having a new X.Y.Z version if needed. Craig sent me a patch for a problem in bcp he was having. I was fixing some issues and extending our tests while I found some issues with bcp. One problem is that bcp code assume that it can preallocate all buffers for data and use them. This assumption was removed many time ago from all code but still present in bcp. The problem is that with blobs server could say "oh, this column can be 2gb" while columns contains only small data. For this reason libTDS does not care about column_size for blobs and allocate data buffers as needed when it receive data. I changed all my configuration to use 500mb as textsize and I wrote a small shared object to limit allocations to 128mb. bcp tests are now failing. The other issue with conversion is that dbconvert either pad data to buffer size when you give a valid buffer size (destlen >= 0) or you can avoid padding passing a negative buffer size. So if you have destlen >= 0 you can have dbconvert filling large quantities of ram while with destlen <0 you can have buffer overflows. Using tds_convert avoid such problems and dbconvert is mainly a wrapper around tds_convert. Also tds_convert already can allocate buffer as needed (and actually is the default used by dbconvert). What do you mean by BCPFILECP and BCPUNICODEFILE ? Supporting input from wide characters encoded files ? >>> The HDBC problem should be discussed. Because the driver manager has >>> no idea about the bcp APIs, the first parameter that all the functions >>> receive is a driver manager HDBC, not a TDS_DBC*. >>> SQLGetInfo(SQL_DRIVER_HDBC) can be used to convert, but that means we >>> need to find SQLGetInfo. Approaches I've thought of so far are: >>> >>> 1) dlopen(...,RTLD_NOLOAD) with various hard-coded filenames to try to >>> find which driver manager the application is using >>> >>> 2) dl_iterate_phdr() to look for filenames that look like the driver >>> manager [this is what's currently in the patch]. >>> >>> 3) dlsym(RTLD_DEFAULT,...). >>> >>> 4) Create a gratuitous libtdsodbcbcp.so containing just thunker >>> functions whose sole purpose is to get out of the way of the default >>> symbol search path so that method (3) works more reliably. >>> >>> Microsoft's Windows driver uses (1) because they know there's only one >>> driver manager. (3) is subject to ordering problems with the symbol >>> search, but those problems exist anyway at link time so I'm beginning >>> to think that might be best. >>> > >> (3) should be fine as odbc drivers (like our one) should be loaded >> with RTLD_LOCAL flag so the SQLGetInfo from our driver is not found >> with RTLD_DEFAULT. >> >> Another idea would be to use a sort of "tunnel" using functions like >> SQLSetConnectAttr. Practically let's say we want to implement >> bcp_collen, we do something like >> >> typedef struct { >> DBINT cbData; >> INT idxServerCol; >> } bcp_collen_params; >> >> RETCODE bcp_collen ( >> HDBC hdbc, >> DBINT cbData, >> INT idxServerCol) >> { >> bcp_collen_params params = { cbData, idxServerCol }; >> return SQLSetConnectAttr(hdbc, SQL_SS_FUNC_BCP_COLLEN, ¶ms, >> sizeof(params)); >> } > > This actually doesn't solve the problem. That call to > SQLSetConnectAttr() will bind to the one in odbc.c, not the one in the > driver manager - it's the same problem as trying to call SQLGetInfo() > directly. I'll go with my option (3). It has the surprising property > that if you link with "gcc -ltdsodbc -lodbc" then you'll bind directly > to FreeTDS and be confused that attempting to use any other driver > doesn't work, but we'll just have to document that you must use "gcc > -lodbc -ltdsodbc". > Well, the wrapper should be statically linked to your application so it can call SQLSetConnectAttr as any other normal DM function. Just my idea. We can work on this problem while working on others. > Richard. > >>> [1] https://msdn.microsoft.com/en-us/library/ms130924.aspx > Frediano From alistair.roberts at ladbrokes.com.au Mon Mar 16 21:51:04 2015 From: alistair.roberts at ladbrokes.com.au (Alistair Roberts) Date: Tue, 17 Mar 2015 11:51:04 +1000 (EST) Subject: [freetds] SQL Server Availability Groups Message-ID: <036c01d06054$d41268c0$7c373a40$@ladbrokes.com.au> Hi, Does FreeTDS support SQL 2014 Availability Groups? We are looking at migrating from SQL 2008 to SQL 2014 and then use Availability Groups for the databases. Ideally we are looking at using a sole IP but we may need to go with the multi-subnet approach for the AG listener. Are there any compatibility issues with FreeTDS and SQL 2014? Regards Alistair Roberts From freddy77 at gmail.com Tue Mar 17 07:31:49 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 17 Mar 2015 11:31:49 +0000 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: Which version did you try? 0.91 or development? It would be good to know the error from GetLastError function. Frediano 2015-03-13 23:32 GMT+00:00 Velichko Yuriy : > The function > > status = sec_fn->InitializeSecurityContext(&auth->cred, &auth->cred_ctx, > auth->sname, > ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION, > 0, SECURITY_NETWORK_DREP, &in_desc, > 0, &auth->cred_ctx, &out_desc, > &attrs, &ts); > > return bad value for my case > > if (status != SEC_E_OK) > return TDS_FAIL; > > Sorry for such spam. I'll be grateful if somebody can help me to figure out > the problem of connection establishing > > > > On 14 March 2015 at 01:16, Velichko Yuriy wrote: > >> Sorry - miss-click. >> >> in result DBPROCESS is NULL. >> >> I try to debug what happens in dbopen, and figure out tat connection >> established properly. >> Problem in function tds_goodread() for stack: >> >> > vs_plugin_db_mssql.dll!tds_goodread(tds_socket * tds, unsigned char * >> buf, int buflen, unsigned char unfinished) Line 437 C >> vs_plugin_db_mssql.dll!goodread(tds_socket * tds, unsigned char * buf, >> int buflen) Line 504 C >> vs_plugin_db_mssql.dll!tds_read_packet(tds_socket * tds) Line 530 C >> vs_plugin_db_mssql.dll!tds_get_byte(tds_socket * tds) Line 73 C >> vs_plugin_db_mssql.dll!tds_process_login_tokens(tds_socket * tds) Line >> 336 C >> vs_plugin_db_mssql.dll!tds_connect(tds_socket * tds, tds_connection * >> connection, int * p_oserr) Line 469 C >> vs_plugin_db_mssql.dll!tds_connect_and_login(tds_socket * tds, >> tds_connection * connection) Line 510 C >> vs_plugin_db_mssql.dll!tdsdbopen(tds_dblib_loginrec * login, const char >> * server, int msdblib) Line 1232 C >> >> Maybe I forgot some params for connection? >> >> On 14 March 2015 at 01:06, Velichko Yuriy >> wrote: >> >>> A little question about Windows SSPI auth. >>> My app uses db-lib. The SQL server and app works on the same machine (win >>> 8.1, SQLServer EXPRESS 12) >>> >>> conf file: >>> >>> host = localhost >>> port = 1433 >>> connect timeout = 0 >>> tds version = >>> 7 >>> .0 >>> use ntlmv2 = yes >>> client charset = UTF-8 >>> >>> Code to connect: >>> >>> dberrhandle( ...); >>> dbmsghandle( ... ); >>> >>> DBSETLUSER( login, "" ); >>> DBSETLPWD( login,"" ); >>> >>> DBPROCESS* conn = dbopen( login, my_app" ); >>> if( conn ) >>> { >>> >>> } >>> else >>> { >>> <<<< Goes here >>> } >>> >>> >>> >>> >>> On 13 March 2015 at 17:03, Velichko Yuriy >>> wrote: >>> >>>> Thanks! >>>> >>>> The first approach works fine. I saw it before but forgot to duplicate >>>> '\' symbol in the user name, so got an error, very shamefully. ) >>>> >>>> Second approach needs more time to realisation but I'm sure that I can >>>> implement it too. >>>> >>>> Thanks for the quick answer. Very helpful. >>>> >>>> On 13 March 2015 at 16:46, Frediano Ziglio wrote: >>>> >>>>> 2015-03-13 14:09 GMT+00:00 Velichko Yuriy : >>>>> > Hello! >>>>> > >>>>> > I can't figure out how to connect to SQL Server via windows auth using >>>>> > fretds library (dblib). >>>>> > >>>>> > In examples is shown how to connect via the SQL authentication. >>>>> > >>>>> > Is there example for windows auth. >>>>> > Should I change conf file, or set specific info to the LOGINREC for >>>>> > dbopen() ? >>>>> >>>>> Hi, >>>>> there are two way. Use domain username/password or use single sign on. >>>>> >>>>> To use domain username/password just specify the domain in your >>>>> username. Something like "DOMAIN_NAME\\user_name" with your domain >>>>> password. Could be that you have to use ntlm version 2 (see >>>>> documentation). >>>>> >>>>> The other option is to use Kerberos or on Windows SSPI. The trick is >>>>> to specify empty strings for username and password. SSPI is used (and >>>>> available) on Windows and will use your logged on user while on any >>>>> other machine you have to setup Kerberos and login (kinit usually) >>>>> before launching your dblib application. >>>>> >>>>> Regards, >>>>> Frediano >>>>> _______________________________________________ >>>>> 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 From ganesh.ranganathan.85 at gmail.com Tue Mar 17 07:36:09 2015 From: ganesh.ranganathan.85 at gmail.com (Ganesh Ranganathan) Date: Tue, 17 Mar 2015 17:06:09 +0530 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: Are you able to connect directly via the command line? From ajmer.dhariwal at salecycle.com Tue Mar 17 08:40:33 2015 From: ajmer.dhariwal at salecycle.com (Ajmer Dhariwal) Date: Tue, 17 Mar 2015 12:40:33 +0000 Subject: [freetds] freebcp failing silently with format file that (tries to) remove double quotes Message-ID: I have an input csv file that has every column quoted in double quotes (""). I have simplified the problem down to a two row csv file. There are 4 columns and two are empty. I am using the format file to strip out the quotes by specifying the quotes as separators and I just can't get it to work - it fails silently with no output or errors The format file works fine I then decided to copy the format file to my Windows 7 desktop and tried the exact same thing via bcp and it worked fine - the data hit the target table with the quotes stripped. Obviously, they're using completely different mechanisms but I would have expected the format files to behave similarly. In my own experimentation I can change the separator and make the corresponding changes to the format file and it works fine but I was wondering if anyone had tackled a similar issue because I cannot change the quoting in some of the input files. I'm escaping the quotes via \" Format file and sample csv with dummy data are attached. Data is being exported from the 4 col csv file into a simple two col table consisting of nvarchar(30) and nvarchar(80) respectively (SQL Server 2012). freebcp version $Id: freebcp.c,v 1.59 2011/03/13 21:32:49 jklowden Exp $ Keep up the good work by the way - freetds and freebcp are lifesavers! Thanks, Ajmer Ajmer?DhariwalDatabase Architect /DBA . .Chase House, 4 Mandarin Road, Rainton Bridge, DH4 5RA. -------------- next part -------------- A non-text attachment was scrubbed... Name: test_emails.fmt Type: application/octet-stream Size: 305 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_emails.csv Type: text/csv Size: 78 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test_emails.fmt Type: application/octet-stream Size: 391 bytes Desc: not available URL: From velichko.yuriy at gmail.com Tue Mar 17 08:57:55 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Tue, 17 Mar 2015 14:57:55 +0200 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: I tried version 0.91. GetLastError after dbopen returns 0. On 17 March 2015 at 13:31, Frediano Ziglio wrote: > Which version did you try? 0.91 or development? It would be good to > know the error from GetLastError function. > > Frediano > > > 2015-03-13 23:32 GMT+00:00 Velichko Yuriy : > > The function > > > > status = sec_fn->InitializeSecurityContext(&auth->cred, &auth->cred_ctx, > > auth->sname, > > ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION, > > 0, SECURITY_NETWORK_DREP, &in_desc, > > 0, &auth->cred_ctx, &out_desc, > > &attrs, &ts); > > > > return bad value for my case > > > > if (status != SEC_E_OK) > > return TDS_FAIL; > > > > Sorry for such spam. I'll be grateful if somebody can help me to figure > out > > the problem of connection establishing > > > > > > > > On 14 March 2015 at 01:16, Velichko Yuriy > wrote: > > > >> Sorry - miss-click. > >> > >> in result DBPROCESS is NULL. > >> > >> I try to debug what happens in dbopen, and figure out tat connection > >> established properly. > >> Problem in function tds_goodread() for stack: > >> > >> > vs_plugin_db_mssql.dll!tds_goodread(tds_socket * tds, unsigned char * > >> buf, int buflen, unsigned char unfinished) Line 437 C > >> vs_plugin_db_mssql.dll!goodread(tds_socket * tds, unsigned char * buf, > >> int buflen) Line 504 C > >> vs_plugin_db_mssql.dll!tds_read_packet(tds_socket * tds) Line 530 C > >> vs_plugin_db_mssql.dll!tds_get_byte(tds_socket * tds) Line 73 C > >> vs_plugin_db_mssql.dll!tds_process_login_tokens(tds_socket * tds) Line > >> 336 C > >> vs_plugin_db_mssql.dll!tds_connect(tds_socket * tds, tds_connection * > >> connection, int * p_oserr) Line 469 C > >> vs_plugin_db_mssql.dll!tds_connect_and_login(tds_socket * tds, > >> tds_connection * connection) Line 510 C > >> vs_plugin_db_mssql.dll!tdsdbopen(tds_dblib_loginrec * login, const > char > >> * server, int msdblib) Line 1232 C > >> > >> Maybe I forgot some params for connection? > >> > >> On 14 March 2015 at 01:06, Velichko Yuriy > >> wrote: > >> > >>> A little question about Windows SSPI auth. > >>> My app uses db-lib. The SQL server and app works on the same machine > (win > >>> 8.1, SQLServer EXPRESS 12) > >>> > >>> conf file: > >>> > >>> host = localhost > >>> port = 1433 > >>> connect timeout = 0 > >>> tds version = > >>> 7 > >>> .0 > >>> use ntlmv2 = yes > >>> client charset = UTF-8 > >>> > >>> Code to connect: > >>> > >>> dberrhandle( ...); > >>> dbmsghandle( ... ); > >>> > >>> DBSETLUSER( login, "" ); > >>> DBSETLPWD( login,"" ); > >>> > >>> DBPROCESS* conn = dbopen( login, my_app" ); > >>> if( conn ) > >>> { > >>> > >>> } > >>> else > >>> { > >>> <<<< Goes here > >>> } > >>> > >>> > >>> > >>> > >>> On 13 March 2015 at 17:03, Velichko Yuriy > >>> wrote: > >>> > >>>> Thanks! > >>>> > >>>> The first approach works fine. I saw it before but forgot to duplicate > >>>> '\' symbol in the user name, so got an error, very shamefully. ) > >>>> > >>>> Second approach needs more time to realisation but I'm sure that I can > >>>> implement it too. > >>>> > >>>> Thanks for the quick answer. Very helpful. > >>>> > >>>> On 13 March 2015 at 16:46, Frediano Ziglio > wrote: > >>>> > >>>>> 2015-03-13 14:09 GMT+00:00 Velichko Yuriy >: > >>>>> > Hello! > >>>>> > > >>>>> > I can't figure out how to connect to SQL Server via windows auth > using > >>>>> > fretds library (dblib). > >>>>> > > >>>>> > In examples is shown how to connect via the SQL authentication. > >>>>> > > >>>>> > Is there example for windows auth. > >>>>> > Should I change conf file, or set specific info to the LOGINREC for > >>>>> > dbopen() ? > >>>>> > >>>>> Hi, > >>>>> there are two way. Use domain username/password or use single sign > on. > >>>>> > >>>>> To use domain username/password just specify the domain in your > >>>>> username. Something like "DOMAIN_NAME\\user_name" with your domain > >>>>> password. Could be that you have to use ntlm version 2 (see > >>>>> documentation). > >>>>> > >>>>> The other option is to use Kerberos or on Windows SSPI. The trick is > >>>>> to specify empty strings for username and password. SSPI is used (and > >>>>> available) on Windows and will use your logged on user while on any > >>>>> other machine you have to setup Kerberos and login (kinit usually) > >>>>> before launching your dblib application. > >>>>> > >>>>> Regards, > >>>>> Frediano > >>>>> _______________________________________________ > >>>>> 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 > -- ?? ?????????, ??????? ????. From velichko.yuriy at gmail.com Tue Mar 17 08:59:58 2015 From: velichko.yuriy at gmail.com (Velichko Yuriy) Date: Tue, 17 Mar 2015 14:59:58 +0200 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: I can connect successfully via tsql: tsql -S localhost from http://sourceforge.net/projects/freetdswindows/ On 17 March 2015 at 13:36, Ganesh Ranganathan < ganesh.ranganathan.85 at gmail.com> wrote: > Are you able to connect directly via the command line? > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > -- ?? ?????????, ??????? ????. From cyreve at gmail.com Tue Mar 17 18:40:28 2015 From: cyreve at gmail.com (Richard Hughes) Date: Tue, 17 Mar 2015 22:40:28 +0000 Subject: [freetds] ODBC bcp In-Reply-To: References: <996340536.20150312193606@rhughes.net> <6910288090.20150313210908@rhughes.net> Message-ID: <937668676.20150317224028@rhughes.net> On 2015-03-15 at 11:46, Frediano Ziglio wrote: > 2015-03-13 21:09 GMT+00:00 Richard Hughes : >> I've been looking at the conversion code today and the only conclusion >> I've reached is that everything I did is wrong. I now assume that I >> should have used odbc_sql2tds() as my template but that's full of >> ipd/apd handling that bcp simply doesn't have. Since the first bug I >> noticed involved nvarchar, I was trying to figure out how the >> character set conversion was supposed to work and now I'm more lost >> than when I started. > > Perhaps I was too direct. I don't think what you did is wrong. First > bcp support is quite strange in ODBC. First is a sql server only > extension on a quite standard API. Second it use types more similar to > dblib than ODBC. Looks like Microsoft copied bcp source into ODBC so > you did actually the same. Nothing wrong in it. I don't know actually > how MS handle nvarchar in bcp code. We can surely help with > conversions. Perhaps you should focus on a problem at a time, you are > starting solving too much stuff altogether. Here's a v2 patch, with nvarchar and decimal now working. You were right - I wasn't as wrong as I thought I was (at least from the point of view of just getting it working). >> Hopefully everything except the datetime2/numeric conversion can be >> put into libTDS, but I'm neither knowledgeable enough nor skilled >> enough to be able to participate in an architectural discussion. If >> you tell me what you're planning to work on and what you need me to >> change then I'll happily do as I'm told. In the mean time I've got a >> lot of tests to write. > > Good, tests are always good. You can have a look at dblib t0016 and > t0017 tests just to get some code to copy/paste. What the problem with > datetime2/numeric ? I ended up mostly stealing from dblib's predictably-named 'bcp.c' test. It does a lot of useful stuff, and the version in the new patch now passes for me. That tests most server-side datatypes, so next on the list is testing conversions from client-side datatypes. Problem is, I can't find anywhere which documents actually what the structures you're supposed to pass are. I've proven by experiment that Microsoft's driver expects SQL_TIMESTAMP_STRUCT/SQL_NUMERIC_STRUCT for datetime2/numeric respectively, but it's going to be really tedious to determine all the types simply by trying them out on Microsoft's driver. Oh well. >>>> The HDBC problem should be discussed. Because the driver manager has >>>> no idea about the bcp APIs, the first parameter that all the functions >>>> receive is a driver manager HDBC, not a TDS_DBC*. >>>> SQLGetInfo(SQL_DRIVER_HDBC) can be used to convert, but that means we >>>> need to find SQLGetInfo. Approaches I've thought of so far are: >>>> >>>> 1) dlopen(...,RTLD_NOLOAD) with various hard-coded filenames to try to >>>> find which driver manager the application is using >>>> >>>> 2) dl_iterate_phdr() to look for filenames that look like the driver >>>> manager [this is what's currently in the patch]. >>>> >>>> 3) dlsym(RTLD_DEFAULT,...). >>>> >>>> 4) Create a gratuitous libtdsodbcbcp.so containing just thunker >>>> functions whose sole purpose is to get out of the way of the default >>>> symbol search path so that method (3) works more reliably. >>>> >>>> Microsoft's Windows driver uses (1) because they know there's only one >>>> driver manager. (3) is subject to ordering problems with the symbol >>>> search, but those problems exist anyway at link time so I'm beginning >>>> to think that might be best. >>>> >> >>> (3) should be fine as odbc drivers (like our one) should be loaded >>> with RTLD_LOCAL flag so the SQLGetInfo from our driver is not found >>> with RTLD_DEFAULT. >>> >>> Another idea would be to use a sort of "tunnel" using functions like >>> SQLSetConnectAttr. Practically let's say we want to implement >>> bcp_collen, we do something like >>> >>> typedef struct { >>> DBINT cbData; >>> INT idxServerCol; >>> } bcp_collen_params; >>> >>> RETCODE bcp_collen ( >>> HDBC hdbc, >>> DBINT cbData, >>> INT idxServerCol) >>> { >>> bcp_collen_params params = { cbData, idxServerCol }; >>> return SQLSetConnectAttr(hdbc, SQL_SS_FUNC_BCP_COLLEN, ¶ms, >>> sizeof(params)); >>> } >> >> This actually doesn't solve the problem. That call to >> SQLSetConnectAttr() will bind to the one in odbc.c, not the one in the >> driver manager - it's the same problem as trying to call SQLGetInfo() >> directly. I'll go with my option (3). It has the surprising property >> that if you link with "gcc -ltdsodbc -lodbc" then you'll bind directly >> to FreeTDS and be confused that attempting to use any other driver >> doesn't work, but we'll just have to document that you must use "gcc >> -lodbc -ltdsodbc". > > Well, the wrapper should be statically linked to your application so > it can call SQLSetConnectAttr as any other normal DM function. Just my > idea. We can work on this problem while working on others. Ah, kind of like my option (4), but with a static library instead of a dynamic one. I'm beginning to consider my patch nearly 'done', in that it works more-or-less reliably as a standalone piece of functionality (and includes at least the functionality that I need for my application). I expect one more version with more tests (as mentioned above) and that might cause a little surgical bug fixing but no massive overhauls. If you could do a full review of this version and tell me where I can tidy it up, I'd appreciate it. I'm not too optimistic about being able to de-duplicate this bit of functionality because, while the high-level look is the same as dblib, just about every detail has had some amount of tweaking. When file I/O comes in then that will no longer be true, but currently it's a tricky problem. Richard. -------------- next part -------------- A non-text attachment was scrubbed... Name: freetds-odbc-bcp-2.patch.gz Type: application/octet-stream Size: 12462 bytes Desc: not available URL: From freddy77 at gmail.com Thu Mar 19 07:12:19 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Thu, 19 Mar 2015 11:12:19 +0000 Subject: [freetds] ODBC bcp In-Reply-To: <937668676.20150317224028@rhughes.net> References: <996340536.20150312193606@rhughes.net> <6910288090.20150313210908@rhughes.net> <937668676.20150317224028@rhughes.net> Message-ID: 2015-03-17 22:40 GMT+00:00 Richard Hughes : > On 2015-03-15 at 11:46, Frediano Ziglio wrote: >> 2015-03-13 21:09 GMT+00:00 Richard Hughes : >>> I've been looking at the conversion code today and the only conclusion >>> I've reached is that everything I did is wrong. I now assume that I >>> should have used odbc_sql2tds() as my template but that's full of >>> ipd/apd handling that bcp simply doesn't have. Since the first bug I >>> noticed involved nvarchar, I was trying to figure out how the >>> character set conversion was supposed to work and now I'm more lost >>> than when I started. >> >> Perhaps I was too direct. I don't think what you did is wrong. First >> bcp support is quite strange in ODBC. First is a sql server only >> extension on a quite standard API. Second it use types more similar to >> dblib than ODBC. Looks like Microsoft copied bcp source into ODBC so >> you did actually the same. Nothing wrong in it. I don't know actually >> how MS handle nvarchar in bcp code. We can surely help with >> conversions. Perhaps you should focus on a problem at a time, you are >> starting solving too much stuff altogether. > > Here's a v2 patch, with nvarchar and decimal now working. You were > right - I wasn't as wrong as I thought I was (at least from the point > of view of just getting it working). > >>> Hopefully everything except the datetime2/numeric conversion can be >>> put into libTDS, but I'm neither knowledgeable enough nor skilled >>> enough to be able to participate in an architectural discussion. If >>> you tell me what you're planning to work on and what you need me to >>> change then I'll happily do as I'm told. In the mean time I've got a >>> lot of tests to write. >> >> Good, tests are always good. You can have a look at dblib t0016 and >> t0017 tests just to get some code to copy/paste. What the problem with >> datetime2/numeric ? > > I ended up mostly stealing from dblib's predictably-named 'bcp.c' > test. It does a lot of useful stuff, and the version in the new patch > now passes for me. > > That tests most server-side datatypes, so next on the list is testing > conversions from client-side datatypes. Problem is, I can't find > anywhere which documents actually what the structures you're supposed > to pass are. I've proven by experiment that Microsoft's driver expects > SQL_TIMESTAMP_STRUCT/SQL_NUMERIC_STRUCT for datetime2/numeric > respectively, but it's going to be really tedious to determine all the > types simply by trying them out on Microsoft's driver. Oh well. > >>>>> The HDBC problem should be discussed. Because the driver manager has >>>>> no idea about the bcp APIs, the first parameter that all the functions >>>>> receive is a driver manager HDBC, not a TDS_DBC*. >>>>> SQLGetInfo(SQL_DRIVER_HDBC) can be used to convert, but that means we >>>>> need to find SQLGetInfo. Approaches I've thought of so far are: >>>>> >>>>> 1) dlopen(...,RTLD_NOLOAD) with various hard-coded filenames to try to >>>>> find which driver manager the application is using >>>>> >>>>> 2) dl_iterate_phdr() to look for filenames that look like the driver >>>>> manager [this is what's currently in the patch]. >>>>> >>>>> 3) dlsym(RTLD_DEFAULT,...). >>>>> >>>>> 4) Create a gratuitous libtdsodbcbcp.so containing just thunker >>>>> functions whose sole purpose is to get out of the way of the default >>>>> symbol search path so that method (3) works more reliably. >>>>> >>>>> Microsoft's Windows driver uses (1) because they know there's only one >>>>> driver manager. (3) is subject to ordering problems with the symbol >>>>> search, but those problems exist anyway at link time so I'm beginning >>>>> to think that might be best. >>>>> >>> >>>> (3) should be fine as odbc drivers (like our one) should be loaded >>>> with RTLD_LOCAL flag so the SQLGetInfo from our driver is not found >>>> with RTLD_DEFAULT. >>>> >>>> Another idea would be to use a sort of "tunnel" using functions like >>>> SQLSetConnectAttr. Practically let's say we want to implement >>>> bcp_collen, we do something like >>>> >>>> typedef struct { >>>> DBINT cbData; >>>> INT idxServerCol; >>>> } bcp_collen_params; >>>> >>>> RETCODE bcp_collen ( >>>> HDBC hdbc, >>>> DBINT cbData, >>>> INT idxServerCol) >>>> { >>>> bcp_collen_params params = { cbData, idxServerCol }; >>>> return SQLSetConnectAttr(hdbc, SQL_SS_FUNC_BCP_COLLEN, ¶ms, >>>> sizeof(params)); >>>> } >>> >>> This actually doesn't solve the problem. That call to >>> SQLSetConnectAttr() will bind to the one in odbc.c, not the one in the >>> driver manager - it's the same problem as trying to call SQLGetInfo() >>> directly. I'll go with my option (3). It has the surprising property >>> that if you link with "gcc -ltdsodbc -lodbc" then you'll bind directly >>> to FreeTDS and be confused that attempting to use any other driver >>> doesn't work, but we'll just have to document that you must use "gcc >>> -lodbc -ltdsodbc". >> >> Well, the wrapper should be statically linked to your application so >> it can call SQLSetConnectAttr as any other normal DM function. Just my >> idea. We can work on this problem while working on others. > > Ah, kind of like my option (4), but with a static library instead of a > dynamic one. > > > I'm beginning to consider my patch nearly 'done', in that it works > more-or-less reliably as a standalone piece of functionality (and > includes at least the functionality that I need for my application). I > expect one more version with more tests (as mentioned above) and that > might cause a little surgical bug fixing but no massive overhauls. > > If you could do a full review of this version and tell me where I can > tidy it up, I'd appreciate it. I'm not too optimistic about being able > to de-duplicate this bit of functionality because, while the > high-level look is the same as dblib, just about every detail has had > some amount of tweaking. When file I/O comes in then that will no > longer be true, but currently it's a tricky problem. > > Richard. Looks good. It's getting more into shape. Do you remember from which changeset you start with your change? Do you have a git branch somewhere? About the linking stuff I have some idea. One is define bcp functions with a macro that translate the header, something like #define bcp_done(dbc) tdsodbc_bcp_done(tdsodbc_bcp_driver_hdbc(dbc)) static inline HDBC tdsodbc_bcp_driver_dbc(HDBC dbc) { SQLSMALLINT handle_len; if (SQLGetInfo(dbc, SQL_DRIVER_HDBC, &dbc, sizeof(dbc), &handle_len) != SQL_SUCCESS) return NULL; return dbc; } With the function defined in the header to so the SQLGetInfo call is made from the application However I think that the way you call tdsodbc_bcp_* functions is not safe. In Unix there is a different concept. While on Windows you say (this is done implicitly by linker) I want function X from library Y in Unix usually you just say I want function X from global symbols. Now the problem is that if you link the DM (like unixODBC) and libtdsodbc and you call a function like SQLGetInfo are you calling unixODBC or FreeTDS? Well... depends from linker order, initializations and so on. Not safe. In Microsoft documentation (like https://msdn.microsoft.com/en-us/library/ms130922.aspx) is explicitly said that you cannot link different drivers, similar linker problem. The DM solve the problem as it loads libraries with LOCAL flag so symbols do not get into global list but you just use dlsym to manually get them. Not a big deal as you can use dlopen(..., LOCAL|NOLOAD) to get library header and dlsym to get symbols. However you have to know library name which could be tricky in a portable way (path change based on configuration flags and filename change from system to system). This was why I had the idea to incapsulate calls using SQLSetConnectAttr (or similar) as DM will convert the handle and call proper driver function no matter what. You could also extend SQLGetInfo to return information you need directly from driver (like handle, function pointers and so on). Frediano From freddy77 at gmail.com Thu Mar 19 07:31:13 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Thu, 19 Mar 2015 11:31:13 +0000 Subject: [freetds] Awesome awesome awesome In-Reply-To: References: Message-ID: Actually it's a while we don't receive donations :) The group is quite shrinking. It's me and some collaboration (although there has been recently quite good code contributions). Usually we don't need that much money and we work for fun on our free time. Recently however I found the necessity to upgrade my Windows test machine to have new versions for daily testing (the machine is actually XP so no mssql 2012 or 2014 :( ). You can use my gmail mail. Actually seems that current Windows licenses are much cheaper! Frediano 2015-03-02 0:05 GMT+00:00 Jorge Chamorro : > Hi, > > I'm a new user of FreeTDS and would like to say that it's working fine for me. > > I've installed it on a raspberrypi 2 in order to provide an plain text sql interface to the db, via tsql via netcat for the rest of the network/clients. They mostly send some small batches of sql every now and then. > > I've had to tweak tsql.c a little bit because it was sending some things/results to stderr that ISTM should be going to stdout instead, and also for some reason at times (and only on the raspberrypi) it wasn't flushing stdout properly, nothing that a few fflush(stdout)s here and there don't fix, and now I have a nice working text interface to the azure ms-sql db. Awesome! > > So, in return, I'd like to donate to the cause, but I can't find the instructions anywhere to do so. (?) > > Thank you! > -- > ( Jorge )(); > > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds From freddy77 at gmail.com Thu Mar 19 10:47:51 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Thu, 19 Mar 2015 14:47:51 +0000 Subject: [freetds] How to connect via windows authentication? In-Reply-To: References: Message-ID: Can you try with a snapshot version? Frediano 2015-03-17 12:59 GMT+00:00 Velichko Yuriy : > I can connect successfully via tsql: > > tsql -S localhost > > from http://sourceforge.net/projects/freetdswindows/ > > On 17 March 2015 at 13:36, Ganesh Ranganathan < > ganesh.ranganathan.85 at gmail.com> wrote: > >> Are you able to connect directly via the command line? >> _______________________________________________ >> 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 From david.horman at odf-limited.com Thu Mar 19 11:47:03 2015 From: david.horman at odf-limited.com (David Horman) Date: Thu, 19 Mar 2015 15:47:03 -0000 Subject: [freetds] Occasional "Query failed" with LAMP to MSSQL 2000 server on intensive queries Message-ID: Hi, Apologies in advance if this is a bit vague - I'm not expecting anyone to be able to figure out what's going on from the following description, I'm really looking more for advice on how to investigate further. For the last few years I've been happily using FreeTDS to query an ageing SQL Server 2000 server using PHP scripts running on a Centos 6 server. Recently, though, the amount of data I've been working with, and the number of complex queries, has increased to the point where I sometimes see long-running, intensive queries failing after approximately (but this is not a firm measurement) a minute with the following output: PHP Warning: mssql_query(): Query failed in [script_name] on line 131 Warning: mssql_query(): Query failed in [script_name] on line 131 Then, it seems, any further queries attempted shortly after in the same script fail with, for example: Warning: mssql_query(): Unable to set query in [script_name] on line 162 PHP Warning: mssql_query(): Unable to set query in [script_name] on line 162 This seems to occur more often if the server is particularly busy, such that I have tried to carefully time my cronjobs not to overlap at night. I've never seen a large query fail when I run it directly in SQL Server Management Studio Express. In some cases I can get around the issue, or at least alleviate its frequency, by breaking large queries into smaller ones covering different ranges of data, but this isn't ideal. I've tried changing FreeTDS's timeout and connection timeout values, but to no avail. I also recently increased mssql.timeout to 600 seconds in php.ini, but this made no difference. freetds.conf (minus comments) looks like this: [global] timeout = 240 connect timeout = 30 text size = 64512 [server_name] host = 192.x.x.x port = 1433 tds version = 7.1 client charset = UTF-8 I forget the reason for setting client charset to UTF-8 but I think it was a good one... Could anyone advise me on what I can do to get more information on what's going wrong? I couldn't find anything unusual logged on the SQL server itself, but again I'm somewhat in the dark as to where to look. Thanks in advance, David From jorge at jorgechamorro.com Thu Mar 19 15:19:16 2015 From: jorge at jorgechamorro.com (=?utf-8?Q?=E2=96=88=E2=96=88_=E2=96=88_Jorge?=) Date: Thu, 19 Mar 2015 20:19:16 +0100 Subject: [freetds] Awesome awesome awesome In-Reply-To: References: Message-ID: On 19/03/2015, at 12:31, Frediano Ziglio wrote: > Actually it's a while we don't receive donations :) > > The group is quite shrinking. It's me and some collaboration (although > there has been recently quite good code contributions). > > Usually we don't need that much money and we work for fun on our free > time. Recently however I found the necessity to upgrade my Windows > test machine to have new versions for daily testing (the machine is > actually XP so no mssql 2012 or 2014 :( ). You can use my gmail mail. > Actually seems that current Windows licenses are much cheaper! [x] DONE Enjoy, FreeTDS has saved my day. Cheers, -- ( Jorge )(); From cyreve at gmail.com Thu Mar 19 15:57:56 2015 From: cyreve at gmail.com (Richard Hughes) Date: Thu, 19 Mar 2015 19:57:56 +0000 Subject: [freetds] ODBC bcp In-Reply-To: References: <996340536.20150312193606@rhughes.net> <6910288090.20150313210908@rhughes.net> <937668676.20150317224028@rhughes.net> Message-ID: <1295775916.20150319195756@rhughes.net> On 2015-03-19 at 11:12, Frediano Ziglio wrote: > 2015-03-17 22:40 GMT+00:00 Richard Hughes : >> I'm beginning to consider my patch nearly 'done', in that it works >> more-or-less reliably as a standalone piece of functionality (and >> includes at least the functionality that I need for my application). I >> expect one more version with more tests (as mentioned above) and that >> might cause a little surgical bug fixing but no massive overhauls. >> >> If you could do a full review of this version and tell me where I can >> tidy it up, I'd appreciate it. I'm not too optimistic about being able >> to de-duplicate this bit of functionality because, while the >> high-level look is the same as dblib, just about every detail has had >> some amount of tweaking. When file I/O comes in then that will no >> longer be true, but currently it's a tricky problem. > > Looks good. It's getting more into shape. Do you remember from which > changeset you start with your change? Do you have a git branch > somewhere? My git-fu is poor, I'm ashamed to admit. The clone I took was 2844e0df4d7c7cbccbd60dcf02e371135b42deec (the top line in the output of git log), but I'm still using git like a non-distributed VCS and keeping everything on my local disk. I really need to fix my lack of knowledge one day. > About the linking stuff I have some idea. One is define bcp functions > with a macro that translate the header, something like > > #define bcp_done(dbc) tdsodbc_bcp_done(tdsodbc_bcp_driver_hdbc(dbc)) > static inline HDBC > tdsodbc_bcp_driver_dbc(HDBC dbc) > { > SQLSMALLINT handle_len; > if (SQLGetInfo(dbc, SQL_DRIVER_HDBC, &dbc, sizeof(dbc), > &handle_len) != SQL_SUCCESS) > return NULL; > return dbc; > } > > With the function defined in the header to so the SQLGetInfo call is > made from the application Cunning. I like it. > However I think that the way you call tdsodbc_bcp_* functions is not > safe. In Unix there is a different concept. While on Windows you say > (this is done implicitly by linker) I want function X from library Y > in Unix usually you just say I want function X from global symbols. > Now the problem is that if you link the DM (like unixODBC) and > libtdsodbc and you call a function like SQLGetInfo are you calling > unixODBC or FreeTDS? Well... depends from linker order, > initializations and so on. Not safe. In Microsoft documentation (like > https://msdn.microsoft.com/en-us/library/ms130922.aspx) is explicitly > said that you cannot link different drivers, similar linker problem. > The DM solve the problem as it loads libraries with LOCAL flag so > symbols do not get into global list but you just use dlsym to manually > get them. Not a big deal as you can use dlopen(..., LOCAL|NOLOAD) to > get library header and dlsym to get symbols. However you have to know > library name which could be tricky in a portable way (path change > based on configuration flags and filename change from system to > system). This was why I had the idea to incapsulate calls using > SQLSetConnectAttr (or similar) as DM will convert the handle and call > proper driver function no matter what. You could also extend > SQLGetInfo to return information you need directly from driver (like > handle, function pointers and so on). I realised while thinking about this that Windows also has the same linker order problem, despite its different runtime behaviour, because at (static) link time the list of symbols being resolved is still put in to one global bucket. I guess it usually gets away with it because odbc32.lib is on the list of 'magic' libraries which always get linked in (whether you asked for it or not) and hence always gets searched first. My current favorite approach is a combination of your inline function and SQLSetConnectAttr tricks, which ends up as basically identical to your bcp_collen, except with "static __inline__" bolted on the front (and an extra struct member for passing the return value back, because bcp doesn't use ODBC return values): >>>>> typedef struct { >>>>> DBINT cbData; >>>>> INT idxServerCol; >>>>> } bcp_collen_params; >>>>> >>>>> RETCODE bcp_collen ( >>>>> HDBC hdbc, >>>>> DBINT cbData, >>>>> INT idxServerCol) >>>>> { >>>>> bcp_collen_params params = { cbData, idxServerCol }; >>>>> return SQLSetConnectAttr(hdbc, SQL_SS_FUNC_BCP_COLLEN, ¶ms, >>>>> sizeof(params)); >>>>> } This has the advantage that there's no need to mess about with linker command lines or static libraries, and the only disadvantage that I can think of is microscopically bulkier application binaries. Richard. From freddy77 at gmail.com Fri Mar 20 06:21:37 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 20 Mar 2015 10:21:37 +0000 Subject: [freetds] dblib assertion crash on connection timeouts In-Reply-To: <447071EC-BD1D-4220-96A0-16A4E72FF086@t-online.hu> References: <447071EC-BD1D-4220-96A0-16A4E72FF086@t-online.hu> Message-ID: 2015-03-07 18:03 GMT+00:00 Daniel Fazekas : > I think it would be preferable if dblib in the current development version wouldn't just crash the host process with an assertion if a connection attempt times out. > dbutil.c:193: _dblib_check_and_handle_interrupt: Assertion `dbproc != ((void *)0) && !dbdead((dbproc))' failed. > > For example, doing a > bsqldb -S microsoft.com > or trying any other firewalled or non-responsive address. > > Returning INT_CANCEL on DBDEAD in _dblib_check_and_handle_interrupt seems to be nicer. Removed the DBDEAD part and checked, not returns correctly timeout error Frediano From freddy77 at gmail.com Fri Mar 20 06:25:14 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 20 Mar 2015 10:25:14 +0000 Subject: [freetds] SQL Server Availability Groups In-Reply-To: <036c01d06054$d41268c0$7c373a40$@ladbrokes.com.au> References: <036c01d06054$d41268c0$7c373a40$@ladbrokes.com.au> Message-ID: 2015-03-17 1:51 GMT+00:00 Alistair Roberts : > Hi, > > > > Does FreeTDS support SQL 2014 Availability Groups? > > No, but it's open source so adding it would be good. > > We are looking at migrating from SQL 2008 to SQL 2014 and then use > Availability Groups for the databases. > > > > Ideally we are looking at using a sole IP but we may need to go with the > multi-subnet approach for the AG listener. > > Do you have any details of the protocol and how does it work? > > Are there any compatibility issues with FreeTDS and SQL 2014? > > No, the protocol used won't be the last but no compatibility problems known. > > Regards > > > Alistair Roberts > Frediano From freddy77 at gmail.com Fri Mar 20 06:31:19 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 20 Mar 2015 10:31:19 +0000 Subject: [freetds] Occasional "Query failed" with LAMP to MSSQL 2000 server on intensive queries In-Reply-To: References: Message-ID: 2015-03-19 15:47 GMT+00:00 David Horman : > Hi, > > > > Apologies in advance if this is a bit vague - I'm not expecting anyone > to be able to figure out what's going on from the following description, > I'm really looking more for advice on how to investigate further. > > > > For the last few years I've been happily using FreeTDS to query an > ageing SQL Server 2000 server using PHP scripts running on a Centos 6 > server. Recently, though, the amount of data I've been working with, and > the number of complex queries, has increased to the point where I > sometimes see long-running, intensive queries failing after > approximately (but this is not a firm measurement) a minute with the > following output: > > > > PHP Warning: mssql_query(): Query failed in [script_name] on line 131 > > Warning: mssql_query(): Query failed in [script_name] on line 131 > > > > Then, it seems, any further queries attempted shortly after in the same > script fail with, for example: > > > > Warning: mssql_query(): Unable to set query in [script_name] on line 162 > > PHP Warning: mssql_query(): Unable to set query in [script_name] on > line 162 > > > > This seems to occur more often if the server is particularly busy, such > that I have tried to carefully time my cronjobs not to overlap at night. > I've never seen a large query fail when I run it directly in SQL Server > Management Studio Express. > > > > In some cases I can get around the issue, or at least alleviate its > frequency, by breaking large queries into smaller ones covering > different ranges of data, but this isn't ideal. I've tried changing > FreeTDS's timeout and connection timeout values, but to no avail. I also > recently increased mssql.timeout to 600 seconds in php.ini, but this > made no difference. > > > > freetds.conf (minus comments) looks like this: > > > > [global] > > timeout = 240 > > connect timeout = 30 > > text size = 64512 > > > > [server_name] > > host = 192.x.x.x > > port = 1433 > > tds version = 7.1 > > client charset = UTF-8 > > > > I forget the reason for setting client charset to UTF-8 but I think it > was a good one... > > > > Could anyone advise me on what I can do to get more information on > what's going wrong? I couldn't find anything unusual logged on the SQL > server itself, but again I'm somewhat in the dark as to where to look. > > > > Thanks in advance, > > > > David > Which FreeTDS version are you using? Configuration looks fine. Just to try if there is any timeout problem (could be due even to some firewall) try the WAITFOR statement, see https://msdn.microsoft.com/en-us/library/ms187331.aspx. This statement just wait so beside the connection does not occupy the server/network. Another problem could be lock contention. If there are too much locking server timeout automatically to prevent deadlock. I don't remember but there should be a setting for this timeout (on the database server). What mssql_get_last_message say? As database server is already busy I'd put some extra logging on the web server to see which kind of errors happen. Regards, Frediano From david.horman at odf-limited.com Fri Mar 20 08:20:51 2015 From: david.horman at odf-limited.com (David Horman) Date: Fri, 20 Mar 2015 12:20:51 -0000 Subject: [freetds] Occasional "Query failed" with LAMP to MSSQL 2000 server on intensive queries References: Message-ID: Thanks for your help - it seems that the WAITFOR command was exactly what I needed to finally get to the bottom of this mystery. It turned out that while I had set mssql.timeout to 600 in php.ini, I had forgotten to uncomment the line! After doing so, and writing a quick PHP script to query the server and WAITFOR 12 minutes, the script gave the "Query failed" error - after exactly 10 minutes. Changing mssql.timeout to 240s caused "Query failed" after exactly 4 minutes. So it seems this was all down to PHP (well, and having such an old server that it takes forever to run queries) after all. Thanks again for your help. David -----Original Message----- From: FreeTDS [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Frediano Ziglio Sent: 20 March 2015 10:31 To: FreeTDS Development Group Subject: Re: [freetds] Occasional "Query failed" with LAMP to MSSQL 2000 server on intensive queries 2015-03-19 15:47 GMT+00:00 David Horman : > Hi, > > > > Apologies in advance if this is a bit vague - I'm not expecting anyone > to be able to figure out what's going on from the following > description, I'm really looking more for advice on how to investigate further. > > > > For the last few years I've been happily using FreeTDS to query an > ageing SQL Server 2000 server using PHP scripts running on a Centos 6 > server. Recently, though, the amount of data I've been working with, > and the number of complex queries, has increased to the point where I > sometimes see long-running, intensive queries failing after > approximately (but this is not a firm measurement) a minute with the > following output: > > > > PHP Warning: mssql_query(): Query failed in [script_name] on line 131 > > Warning: mssql_query(): Query failed in [script_name] on line 131 > > > > Then, it seems, any further queries attempted shortly after in the > same script fail with, for example: > > > > Warning: mssql_query(): Unable to set query in [script_name] on line > 162 > > PHP Warning: mssql_query(): Unable to set query in [script_name] on > line 162 > > > > This seems to occur more often if the server is particularly busy, > such that I have tried to carefully time my cronjobs not to overlap at night. > I've never seen a large query fail when I run it directly in SQL > Server Management Studio Express. > > > > In some cases I can get around the issue, or at least alleviate its > frequency, by breaking large queries into smaller ones covering > different ranges of data, but this isn't ideal. I've tried changing > FreeTDS's timeout and connection timeout values, but to no avail. I > also recently increased mssql.timeout to 600 seconds in php.ini, but > this made no difference. > > > > freetds.conf (minus comments) looks like this: > > > > [global] > > timeout = 240 > > connect timeout = 30 > > text size = 64512 > > > > [server_name] > > host = 192.x.x.x > > port = 1433 > > tds version = 7.1 > > client charset = UTF-8 > > > > I forget the reason for setting client charset to UTF-8 but I think it > was a good one... > > > > Could anyone advise me on what I can do to get more information on > what's going wrong? I couldn't find anything unusual logged on the SQL > server itself, but again I'm somewhat in the dark as to where to look. > > > > Thanks in advance, > > > > David > Which FreeTDS version are you using? Configuration looks fine. Just to try if there is any timeout problem (could be due even to some firewall) try the WAITFOR statement, see https://msdn.microsoft.com/en-us/library/ms187331.aspx. This statement just wait so beside the connection does not occupy the server/network. Another problem could be lock contention. If there are too much locking server timeout automatically to prevent deadlock. I don't remember but there should be a setting for this timeout (on the database server). What mssql_get_last_message say? As database server is already busy I'd put some extra logging on the web server to see which kind of errors happen. Regards, Frediano _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org http://lists.ibiblio.org/mailman/listinfo/freetds From shawjef3 at gmail.com Fri Mar 20 11:05:45 2015 From: shawjef3 at gmail.com (Jeffrey Shaw) Date: Fri, 20 Mar 2015 11:05:45 -0400 Subject: [freetds] dblib either truncates nvarchar, or makes NULLs empty strings Message-ID: Hello, I am having two problems. If I set the tds version to 7.1, empty strings are selected as NULL. If I set the tds version to something else, strings longer than 255 characters are truncated. My guess is that in the case of tds version 7.1, types marked with * at http://www.freetds.org/tds.html#types are using "size == 0" when checking for null, rather than the correct "size == -1". "size == 0" is an empty string, whereas "size == -1" is NULL. It isn't clear to me where in the source this check is happening, so I'm applying here for help. I've tried CentOS 7's FreeTDS .91 and also freetds-dev-0.92.965. Thanks, Jeff From fdsubs at t-online.hu Sat Mar 21 01:33:58 2015 From: fdsubs at t-online.hu (Daniel Fazekas) Date: Sat, 21 Mar 2015 06:33:58 +0100 Subject: [freetds] UTF-16 support Message-ID: <8DDFFC0D-C4E9-4862-8EAE-57A020BC3900@t-online.hu> I'm testing the recently committed UTF-16 support. I believe this line in src/tds/config.c's tds_config_login() is wrong: connection->use_utf16 = login->use_utf16; It only ends up turning off the UTF-16 support you asked for in the configuration files, which previously got read into the "connection" structure, with a zero from the "login" structure. So the "use utf-16 = yes" line from freetds.conf gets overwritten and ignored. Simply removing the line works, or wrapping it like all the other boolean options: if (login->use_utf16) { connection->use_utf16 = login->use_utf16; } Then everything appears to work fine with dblib and ctlib. From freddy77 at gmail.com Sat Mar 21 13:18:51 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Sat, 21 Mar 2015 17:18:51 +0000 Subject: [freetds] UTF-16 support In-Reply-To: <8DDFFC0D-C4E9-4862-8EAE-57A020BC3900@t-online.hu> References: <8DDFFC0D-C4E9-4862-8EAE-57A020BC3900@t-online.hu> Message-ID: 2015-03-21 5:33 GMT+00:00 Daniel Fazekas : > I'm testing the recently committed UTF-16 support. > > I believe this line in src/tds/config.c's tds_config_login() is wrong: > connection->use_utf16 = login->use_utf16; > > It only ends up turning off the UTF-16 support you asked for in the configuration files, which previously got read into the "connection" structure, with a zero from the "login" structure. So the "use utf-16 = yes" line from freetds.conf gets overwritten and ignored. > Simply removing the line works, or wrapping it like all the other boolean options: > if (login->use_utf16) { > connection->use_utf16 = login->use_utf16; > } > > Then everything appears to work fine with dblib and ctlib. > Good catch, fixed Frediano From alistair.roberts at ladbrokes.com.au Sun Mar 22 19:52:04 2015 From: alistair.roberts at ladbrokes.com.au (Alistair Roberts) Date: Mon, 23 Mar 2015 09:52:04 +1000 (EST) Subject: [freetds] SQL Server Availability Groups In-Reply-To: References: <036c01d06054$d41268c0$7c373a40$@ladbrokes.com.au> Message-ID: <023d01d064fb$30be4850$923ad8f0$@ladbrokes.com.au> -----Original Message----- From: FreeTDS [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Frediano Ziglio Sent: Friday, 20 March 2015 8:25 PM To: FreeTDS Development Group Subject: Re: [freetds] SQL Server Availability Groups 2015-03-17 1:51 GMT+00:00 Alistair Roberts : > Hi, > > > > Does FreeTDS support SQL 2014 Availability Groups? > > No, but it's open source so adding it would be good. > > We are looking at migrating from SQL 2008 to SQL 2014 and then use > Availability Groups for the databases. > > > > Ideally we are looking at using a sole IP but we may need to go with > the multi-subnet approach for the AG listener. > > Do you have any details of the protocol and how does it work? The availability group has a listener IP and port (often 1433) that SQL connections are directed to. It is possible to have read only replicas of the same database. So if a connection has ReadIntent in the connection string it will go to a read only version. > > Are there any compatibility issues with FreeTDS and SQL 2014? > > No, the protocol used won't be the last but no compatibility problems known. > > Regards > > > Alistair Roberts > Frediano _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org http://lists.ibiblio.org/mailman/listinfo/freetds From freddy77 at gmail.com Mon Mar 23 14:55:27 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Mon, 23 Mar 2015 18:55:27 +0000 Subject: [freetds] New release is getting ready Message-ID: Hi, although there is no dates planned nor any release candidate/beta/alpha/whatever my TODO list for the release is getting shorter! As somebody would have noted I mostly updated documentation to reflect changes. The only big point left is SSL certificate check (there are no code at all although I'll have a look at curl implementation and there are explanation on how to test). I want this in the release as it is a no back compatible change so is better to have in a release. Any help or test is really appreciated. Frediano From fdsubs at t-online.hu Tue Mar 24 05:31:40 2015 From: fdsubs at t-online.hu (Daniel Fazekas) Date: Tue, 24 Mar 2015 10:31:40 +0100 Subject: [freetds] New release is getting ready In-Reply-To: References: Message-ID: Great work on the new release, Freddy! Reading about James retiring earlier this year made me feel all nostalgic. Eventually it grew into this strange curiosity to once again see what using FreeTDS and SQL Server are like these days, rather than just passively hanging around on the mailing list. So I ended up installing a copy of SQL Server 2014 and keeping up to date with your changes the past couple of weeks. I've been playing around with them and testing many things, both on Mac and Linux, and I have to agree: FreeTDS feels ready for a new release. It's very satisfying to store and retrieve emojis. ? The one repeating issue I kept running into is that, unfortunately, FreeTDS really is only the first part of the puzzle for even most developer end users. It's so easy to wrongly assume that problems start or end with FreeTDS when, in fact, the library was fine all along, and the problems are further up the chain. I can only hope a new release of FreeTDS will also spur the developers of dependent software to issue some long-overdue updates. Sqsh is still stuck at no higher than TDS 7.1, or it would try and malloc (unsigned)-1 for any VARCHAR(MAX) column. TDS 7.3 won't actually be usable by anything interfacing with dblib or ctlib until they too add support for the SYBMSDATE / SYBMSTIME / SYBMSDATETIME2 / SYBMSDATETIMEOFFSET types. And PHP's pdo_odbc is in an especially sad state that makes it practically unfeasible. Rather disheartening to see bugs reported against it 7 years ago seeing no improvement still. One thing that did work better with Microsoft's binary-only 2013 release of ?Microsoft ODBC Driver 11 for SQL Server on Linux? is that it supports binding UTF-8 input parameters as SQL_C_CHAR which will then survive a trip to an NVARCHAR column server-side to be stored as UTF-16. FreeTDS instead insists on immediately trying to iconv the UTF-8 to CP1252 (my SQL Server's single-byte encoding). I did note that this already seems to be on your TODO wishlist, and that even this could work through FreeTDS if only the clients used WCHARs instead. > On Mar 23, 2015, at 19:55, Frediano Ziglio wrote: > > Hi, > although there is no dates planned nor any release > candidate/beta/alpha/whatever my TODO list for the release is getting > shorter! As somebody would have noted I mostly updated documentation > to reflect changes. > > The only big point left is SSL certificate check (there are no code at > all although I'll have a look at curl implementation and there are > explanation on how to test). I want this in the release as it is a no > back compatible change so is better to have in a release. > > Any help or test is really appreciated. > > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds From lacak at zoznam.sk Wed Mar 25 07:45:15 2015 From: lacak at zoznam.sk (LacaK) Date: Wed, 25 Mar 2015 12:45:15 +0100 Subject: [freetds] New release is getting ready In-Reply-To: References: Message-ID: <55129FCB.2000908@zoznam.sk> Hi, To get positive example feedback: We use FreeTDS db-lib as client library with FreePascal/Lazarus sqlDB components to connect to MS SQL Servers and Sybase. We use already TDS 7.3 new data types, so we are in line with current FreeTDS. -Laco. > Great work on the new release, Freddy! > Reading about James retiring earlier this year made me feel all nostalgic. Eventually it grew into this strange curiosity to once again see what using FreeTDS and SQL Server are like these days, rather than just passively hanging around on the mailing list. > > So I ended up installing a copy of SQL Server 2014 and keeping up to date with your changes the past couple of weeks. I've been playing around with them and testing many things, both on Mac and Linux, and I have to agree: FreeTDS feels ready for a new release. > It's very satisfying to store and retrieve emojis. ? > > The one repeating issue I kept running into is that, unfortunately, FreeTDS really is only the first part of the puzzle for even most developer end users. It's so easy to wrongly assume that problems start or end with FreeTDS when, in fact, the library was fine all along, and the problems are further up the chain. I can only hope a new release of FreeTDS will also spur the developers of dependent software to issue some long-overdue updates. > > Sqsh is still stuck at no higher than TDS 7.1, or it would try and malloc (unsigned)-1 for any VARCHAR(MAX) column. TDS 7.3 won't actually be usable by anything interfacing with dblib or ctlib until they too add support for the SYBMSDATE / SYBMSTIME / SYBMSDATETIME2 / SYBMSDATETIMEOFFSET types. And PHP's pdo_odbc is in an especially sad state that makes it practically unfeasible. Rather disheartening to see bugs reported against it 7 years ago seeing no improvement still. > > One thing that did work better with Microsoft's binary-only 2013 release of ?Microsoft ODBC Driver 11 for SQL Server on Linux? is that it supports binding UTF-8 input parameters as SQL_C_CHAR which will then survive a trip to an NVARCHAR column server-side to be stored as UTF-16. > FreeTDS instead insists on immediately trying to iconv the UTF-8 to CP1252 (my SQL Server's single-byte encoding). > I did note that this already seems to be on your TODO wishlist, and that even this could work through FreeTDS if only the clients used WCHARs instead. > >> On Mar 23, 2015, at 19:55, Frediano Ziglio wrote: >> >> Hi, >> although there is no dates planned nor any release >> candidate/beta/alpha/whatever my TODO list for the release is getting >> shorter! As somebody would have noted I mostly updated documentation >> to reflect changes. >> >> The only big point left is SSL certificate check (there are no code at >> all although I'll have a look at curl implementation and there are >> explanation on how to test). I want this in the release as it is a no >> back compatible change so is better to have in a release. >> >> Any help or test is really appreciated. >> >> Frediano >> _______________________________________________ >> 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 From PrasannaLakshmi.Kandula at cognizant.com Fri Mar 27 03:04:58 2015 From: PrasannaLakshmi.Kandula at cognizant.com (PrasannaLakshmi.Kandula at cognizant.com) Date: Fri, 27 Mar 2015 07:04:58 +0000 Subject: [freetds] Unclosed quotation mark In-Reply-To: References: Message-ID: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> Hi We are trying to do a SELECT from our application code on SQL server 2008/R2. We are continuously getting the below error in our trace log files : SELECT: error when executing statement: [unixODBC][FreeTDS][SQL Server]Communication link failure Could you please help us in diagnosing this issue urgently on a production level priority Thanks, Prasanna, 9052297408. Vnet:684486 This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. From freddy77 at gmail.com Fri Mar 27 04:28:29 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Fri, 27 Mar 2015 08:28:29 +0000 Subject: [freetds] Unclosed quotation mark In-Reply-To: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> References: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> Message-ID: 2015-03-27 7:04 GMT+00:00 : > Hi > > We are trying to do a SELECT from our application code on SQL server 2008/R2. > We are continuously getting the below error in our trace log files : > SELECT: error when executing statement: [unixODBC][FreeTDS][SQL Server]Communication link failure > > Could you please help us in diagnosing this issue urgently on a production level priority > > > > Thanks, > Prasanna, > 9052297408. > Vnet:684486 > > Hi, which trace? Do you have any other logs? What were you trying to do? Which FreeTDS version are you using? Do you have the SELECT statement? Which configuration are you using? Which OS? Frediano From Alexander.Mittel at siemens.com Fri Mar 27 04:31:42 2015 From: Alexander.Mittel at siemens.com (Mittel, Alexander) Date: Fri, 27 Mar 2015 08:31:42 +0000 Subject: [freetds] Unclosed quotation mark / Communication link failure In-Reply-To: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> References: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> Message-ID: Hi under windows we get this error when network connection between client and server was (even temporary) interrupted. Mfg Alexander Mittel -----Urspr?ngliche Nachricht----- Von: FreeTDS [mailto:freetds-bounces at lists.ibiblio.org] Im Auftrag von PrasannaLakshmi.Kandula at cognizant.com Gesendet: Freitag, 27. M?rz 2015 08:05 An: freetds at lists.ibiblio.org Cc: Sudip.Manpuria at cognizant.com Betreff: Re: [freetds] Unclosed quotation mark Hi We are trying to do a SELECT from our application code on SQL server 2008/R2. We are continuously getting the below error in our trace log files : SELECT: error when executing statement: [unixODBC][FreeTDS][SQL Server]Communication link failure Could you please help us in diagnosing this issue urgently on a production level priority Thanks, Prasanna, 9052297408. Vnet:684486 This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org http://lists.ibiblio.org/mailman/listinfo/freetds From PrasannaLakshmi.Kandula at cognizant.com Fri Mar 27 07:27:30 2015 From: PrasannaLakshmi.Kandula at cognizant.com (PrasannaLakshmi.Kandula at cognizant.com) Date: Fri, 27 Mar 2015 11:27:30 +0000 Subject: [freetds] Unclosed quotation mark In-Reply-To: References: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> Message-ID: <958824D93B81784DACE2A262CBFC0B161BBFC10D@CTSINCHNSXMBM.cts.com> Hi Frediano, We are trying to connect from a middleware application to SQL .We are trying to fetch data from a table from DB. We have used freetds0.91 version .Our middleware application is installed on LINUX. We have our own application traces and logs . Please let me know if you need any more details. Thanks, Prasanna, 9052297408. Vnet:684486 -----Original Message----- From: FreeTDS [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Frediano Ziglio Sent: Friday, March 27, 2015 1:58 PM To: FreeTDS Development Group Cc: Manpuria, Sudip (Cognizant) Subject: Re: [freetds] Unclosed quotation mark 2015-03-27 7:04 GMT+00:00 : > Hi > > We are trying to do a SELECT from our application code on SQL server 2008/R2. > We are continuously getting the below error in our trace log files : > SELECT: error when executing statement: [unixODBC][FreeTDS][SQL Server]Communication link failure > > Could you please help us in diagnosing this issue urgently on a production level priority > > > > Thanks, > Prasanna, > 9052297408. > Vnet:684486 > > Hi, which trace? Do you have any other logs? What were you trying to do? Which FreeTDS version are you using? Do you have the SELECT statement? Which configuration are you using? Which OS? Frediano _______________________________________________ FreeTDS mailing list FreeTDS at lists.ibiblio.org http://lists.ibiblio.org/mailman/listinfo/freetds This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. From ddick at cpan.org Fri Mar 27 15:54:18 2015 From: ddick at cpan.org (David Dick) Date: Sat, 28 Mar 2015 06:54:18 +1100 Subject: [freetds] Unclosed quotation mark In-Reply-To: <958824D93B81784DACE2A262CBFC0B161BBFC10D@CTSINCHNSXMBM.cts.com> References: <958824D93B81784DACE2A262CBFC0B161BBFBBF5@CTSINCHNSXMBM.cts.com> <958824D93B81784DACE2A262CBFC0B161BBFC10D@CTSINCHNSXMBM.cts.com> Message-ID: <5515B56A.1070000@cpan.org> Hi Prasanna, The only piece of information you have supplied is the version number of freetds that you are using. This is not enough information. FreeTDS works for a lot of people in a lot of environments. You need to help us see what has gone wrong in your environment. Therefore, as a first step, read the available documention on logging for unixODBC for FreeTDS at http://www.freetds.org/userguide/logging.htm Enable logging for unixODBC, then after checking the logfile yourself, post the relevant snippets to the list and somebody might be able to help you. Cheers David On 03/27/2015 10:27 PM, PrasannaLakshmi.Kandula at cognizant.com wrote: > Hi Frediano, > > We are trying to connect from a middleware application to SQL .We are trying to fetch data from a table from DB. > We have used freetds0.91 version .Our middleware application is installed on LINUX. > We have our own application traces and logs . > Please let me know if you need any more details. > > > Thanks, > Prasanna, > 9052297408. > Vnet:684486 > > > > > > -----Original Message----- > From: FreeTDS [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of Frediano Ziglio > Sent: Friday, March 27, 2015 1:58 PM > To: FreeTDS Development Group > Cc: Manpuria, Sudip (Cognizant) > Subject: Re: [freetds] Unclosed quotation mark > > 2015-03-27 7:04 GMT+00:00 : >> Hi >> >> We are trying to do a SELECT from our application code on SQL server 2008/R2. >> We are continuously getting the below error in our trace log files : >> SELECT: error when executing statement: [unixODBC][FreeTDS][SQL Server]Communication link failure >> >> Could you please help us in diagnosing this issue urgently on a production level priority >> >> >> >> Thanks, >> Prasanna, >> 9052297408. >> Vnet:684486 >> >> > Hi, > which trace? Do you have any other logs? What were you trying to do? > Which FreeTDS version are you using? Do you have the SELECT statement? > Which configuration are you using? Which OS? > > Frediano > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored. > _______________________________________________ > FreeTDS mailing list > FreeTDS at lists.ibiblio.org > http://lists.ibiblio.org/mailman/listinfo/freetds > From cyreve at gmail.com Mon Mar 30 17:03:38 2015 From: cyreve at gmail.com (Richard Hughes) Date: Mon, 30 Mar 2015 22:03:38 +0100 Subject: [freetds] ODBC bcp In-Reply-To: <1295775916.20150319195756@rhughes.net> References: <996340536.20150312193606@rhughes.net> <6910288090.20150313210908@rhughes.net> <937668676.20150317224028@rhughes.net> <1295775916.20150319195756@rhughes.net> Message-ID: <984582980.20150330220338@rhughes.net> Here's my v3 patch (hopefully in a slightly more gitish format - still trying to figure out which of the various workflows on offer is appropriate). I think I've addressed everything discussed, including redoing how the new functions are called, adding some more stuff to the unit test and fixing a few bugs thereby found. I've got a couple of questions outstanding: 1) I think I've found a bug in Microsoft's sqlncli11: inserting from an application type of SQL_NUMERIC_STRUCT to a column of type varchar appears to ignore the 'scale' of the decimal. This is commented in the unit test, but causes an attempt to insert 3.141593 (SQL_NUMERIC_STRUCT) to come out as '3141593' (varchar). What's the general policy for things like this? Do we attempt bug-compatibility? I don't imagine many people will want this particular conversion - I only spotted it by accident. 2) I'm testing inserting to a datetime2 column. It works fine but tcpdump shows that it's actually being sent as a nvarchar over the wire, not binary. I'm assuming this is not my fault, but rather an underlying problem in src/tds/bulk.c which should be treated as a separate patch. If you think it is my fault then I'd appreciate it if you could point out where I might have gone wrong. Richard. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Add-support-for-bcp-bulk-copy-using-ODBC-connections.patch.gz Type: application/octet-stream Size: 13167 bytes Desc: not available URL: From lacak at zoznam.sk Tue Mar 31 06:26:28 2015 From: lacak at zoznam.sk (LacaK) Date: Tue, 31 Mar 2015 12:26:28 +0200 Subject: [freetds] Assertin failed: unknown bindtype with unknown varlen Message-ID: <551A7654.8090104@zoznam.sk> Hi, I get this error "unknown bindtype with unknown varlen" when calling dbconvert() in dblib. This is my situation: I have table with VARBINARY column with value which is empty not null (dbdatlen() = 0) Then I call dbconvert with srctype=SQLBINARY, srclen=0, desttype=SQLBINARY, destlen > 0 and I get above mentioned assertion. Looking into dbconvert there is in the begining (note condition: srclen==0): if (src == NULL || srclen == 0) { int bind = dbbindtype(desttype); int size = tds_get_size_by_type(desttype); if (SYBCHAR == desttype) { if (destlen > 0) { size = destlen; bind = CHARBIND; } else { size = 1; bind = NTBSTRINGBIND; } } dbgetnull(dbproc, bind, size, dest); // <--- HERE OCCURS ASSERTION return size; } Next look into dbgetnull(): /* * For variable-length types, nonpositive varlen indicates * buffer is "big enough" but also not to pad. * Apply terminator (if applicable) and go home. */ if (varlen <= 0) { switch (bindtype) { case STRINGBIND: case NTBSTRINGBIND: varaddr[pnullrep->len] = '\0'; /* fall thru */ case CHARBIND: case VARYCHARBIND: + case BINARYBIND: // <--- MISSING HERE ? + case VARYBINBIND: // <--- MISSING HERE ? break; As BINARYBIND is not handled ATM default is executed: default: assert(!"unknown bindtype with unknown varlen"); Can you please fix it ? Thanks -Laco. From freddy77 at gmail.com Tue Mar 31 16:27:10 2015 From: freddy77 at gmail.com (Frediano Ziglio) Date: Tue, 31 Mar 2015 21:27:10 +0100 Subject: [freetds] ODBC bcp In-Reply-To: <984582980.20150330220338@rhughes.net> References: <996340536.20150312193606@rhughes.net> <6910288090.20150313210908@rhughes.net> <937668676.20150317224028@rhughes.net> <1295775916.20150319195756@rhughes.net> <984582980.20150330220338@rhughes.net> Message-ID: 2015-03-30 22:03 GMT+01:00 Richard Hughes : > Here's my v3 patch (hopefully in a slightly more gitish format - still > trying to figure out which of the various workflows on offer is > appropriate). > Yes, git format-patch format is fine. Patch looks really good. Perhaps need some cleanup and some update on comments but it's working. > I think I've addressed everything discussed, including redoing how the > new functions are called, adding some more stuff to the unit test and > fixing a few bugs thereby found. > > I've got a couple of questions outstanding: > > 1) I think I've found a bug in Microsoft's sqlncli11: inserting from > an application type of SQL_NUMERIC_STRUCT to a column of type varchar > appears to ignore the 'scale' of the decimal. This is commented in the > unit test, but causes an attempt to insert 3.141593 > (SQL_NUMERIC_STRUCT) to come out as '3141593' (varchar). What's the > general policy for things like this? Do we attempt bug-compatibility? > I don't imagine many people will want this particular conversion - I > only spotted it by accident. > I don't think emulating a bug like this is of any help. > 2) I'm testing inserting to a datetime2 column. It works fine but > tcpdump shows that it's actually being sent as a nvarchar over the > wire, not binary. I'm assuming this is not my fault, but rather an > underlying problem in src/tds/bulk.c which should be treated as a > separate patch. If you think it is my fault then I'd appreciate it if > you could point out where I might have gone wrong. > Are you sure you are using protocol 7.3 ? If you use a former protocol sql server send datetime2 as nvarchar. > Richard. Frediano