Page 1 of 2

TZConnection, MSSQL, Windows Authentication, TDS

Posted: 25.01.2016, 13:57
by Radek
Can TZConnection connect to MSSQL with "Windows Authentication" using a FreeTDS_MsSQL>=2005 protocol?
If so, how to set properties of TZConnection so as to achieve this goal?

Best regards,
Radek

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 25.01.2016, 20:06
by marsupilami
Hello Radek,

it seems, this is perfectly possible. Just leave username and password empty and you will be connected with trusted authentication. This requires freetds to be compiled with SSPI.
With best regards,

Jan

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 25.01.2016, 21:57
by EgonHugeist
Nope it isn't, there is a opened ticked on FreeTDS.org or our compilated lib's are wrong.

I've been excluding this approch. Trying this raises a bad AV in the lib...

Sorry have to pass. With the ntwdblib.dll it works like a charm.

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 07:58
by marsupilami
Hello Michael,

indeed I didn't take the libs from svn for the test. I downloaded the R0_95 release from github and compiled it using Visual Studio 2013 Community Edition and Cmake. With this library I can connect to my local SQL Server 2008R2 without specifying a username and a password. If I do a select current_user I get dbo as a result. I get the same result if I use trusted authentication in SQL Server Studio. I will attach my life here later on. Bur beware - it depends on the runtime libs of Visual Studio 2013.

Best regards,

Jan

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 10:14
by miab3
Jan,

Can you share this compiled version?
Even better both Win32 and Win64.

Michal

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 11:06
by marsupilami
Hello Radek, hello Michael,

I attached the library that I generated yesterday to this post. I took the source from the Releases part of the FreeTDS github repository. If you go by the version number, the download from the FreeTDS website is an even more current version (0.95.80) but currently I don't have the time to compile it and redo the tests, I did yesterday.

The attached library is built with Visual Studio 2013 Update 4. It depends on the MSVCR120.DLL which basically means the C++ 2013 runtime libraries. It is a 32 Bit version. Although it is named sybdb.dll it connected to MSSQL without problems.

With best regards,

Jan

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 15:50
by miab3
Jan,

I think it is not good library.
See attachment
err_dblib.png
Michal

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 15:53
by Radek
Jan,

your library works without any problem, of course after installation of "Visual C++ Redistributable Packages for Visual Studio 2013".

Thank you very much.

Best regards,
Radek

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 16:33
by Radek
Michal,

could you send me that problematic strings, I would like to test them in my project.

Best regards,
Radek

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 16:56
by marsupilami
Hello Michal,

I only did a small test. I will have to setup a test database to use the zeos tests against. But then I am interested in your configuration. What Server are you using? Which driver and which character set did you use in Zeos? What is the character set of your database? What are the correct strings that should have been displayed? I see a column named TABLE_NAME. Did you get that data using TZSQLMetadata?
The library I suplied is compiled without ICONV suport. So that might be a reason for data transliteration to fail.
With best regards,

Jan

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 17:43
by miab3
@Jan, @Radek,

Connect ( attached) app to your server (with large amounts of tables) and click All.
I tested on DXE2-32, DX10 Seattle-32; MSSQL 2008,2012.
Free_bad.zip
Michal

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 26.01.2016, 20:03
by Radek
Michal,

I haven't found anything wrong during a test using your project. I tested it on Win 64bit, DXE2, MSSQL 2008 R2. A table from ZQuery1 had near 1000 rows. I opened ZQuery1 and scrolled down so as to review all records, in effect haven't found incorrect entries.


Regards,
Radek

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 27.01.2016, 09:30
by marsupilami
Hello Michal,

I connected to some databases yesterday and also didn't find a problem. But then these only had about 50 to 70 tables. I also created a table with some german umlauts to have some characters that exceed the typical ascii range. But everything went fine. I can only make assumptions on why that is.

I also think about coming up with a test that will create a lot of tables with random names that use unicode characters in their name and see what happens. But I assume, I will not be able to do that before the weekend. To take my test environment closer to your environment it would be good to know which version of Microsoft SQL Server you use.

With best regards,

Jan
Jan

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 27.01.2016, 11:54
by miab3
@Jan,

"it would be good to know which version of Microsoft SQL Server you use."

MS SQL EXPRESS:
DBMS name = Microsoft SQL Server
DBMS version = 10.50.2500

DBMS name = Microsoft SQL Server
DBMS version = 11.00.5343

Delphi 2007, XE2, 10 Seattle
ZEOS 7.2 r 3779

Michal

Re: TZConnection, MSSQL, Windows Authentication, TDS

Posted: 28.01.2016, 21:37
by marsupilami
Hello Michal,

thank you - I will prepare the test. I just want to know wether that lib works or not - and also wether it might be concerned as some kind of a Zeos bug :-)
I will let you know about the test results and post the test procedure here.

Best regards and have a nice weekend,

Jan