Connecting to SQL Server lazarus / 16-Databases ---------------------------------------------------------------------- Stag76 · 2019-10-15 02:58 I'm developing an application that connects to a SQL Server, using a ZEOS tZConnection. This works fine connecting to a (Local) SQLServer/DataBase, but I cannot get it to connect to a Server on another machine, giving OSError 0053 - SQL Server does not exist or Network Access Denied. I can connect to the remote Server using SSMS. Does anybody have an example of the tZConnection.Properties required. I'm using Lazarus 1.0.14, ZEOS 7.1.2(Stable), and SQLServer 2014. ---------------------------------------------------------------------- paweld · 2019-10-15 03:37 install version 7.3 of Zeos and change protocol to OleDB ---------------------------------------------------------------------- Stag76 · 2019-10-16 20:00 Thanks for the reply. Is this a limitation in ZEOS 7.1.2, or am I using it incorrectly. I thought having the GUI and Data on separate servers would be a common approach, so I was surprised that I could only connect to to the Local Server. I'm also using ntwdblib.dll...should I switch to dbLib.dll? If I install ZEOS 7.3, which Version of Lazarus should I use? Thanks again. ---------------------------------------------------------------------- af0815 · 2019-10-17 10:35 ntwdblib.dll is a very old dll from M$. I am using freetds libraries for win32, win64 and linux (Debian, Raspbian) derivates. It work with Zeos and SqlDB for me, to connect to MS-SQLServer (running on windows and ubuntu) The actual stable from Lazarus will be ok. (I am using fixes) ---------------------------------------------------------------------- Rainbow6 · 2019-10-17 21:09 Hi, can I ask, what I have to do, to use FreeTDS with Lazarus? I haven’t figured it out yet. Right now I always use ODBC to connect to SQL Server. Whenever I try to use the TMSSQLConnection, I’m getting runtime errors - even if I drop the freetds DLL into the same directory where the EXE resides. This really puzzles me. I would really appreciate any tip or help - haven’t found anything using Google. Thanks and kind regards, Daniel ---------------------------------------------------------------------- af0815 · 2019-10-18 10:03 I always create the connection by code, not by Designer, to set the correct lib. This sample works for SQLdb. For Zeos you can use nearly the same functionallity. At windows the dll resides in the same dir like the main exe. On Linux it depends on the linux system. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TDMSql.DataModuleCreate(Sender: TObject);begin  {$ifdef SQLDebug}DebugLn({$I %FILE%} + '->' +{$I %CURRENTROUTINE%} +' start');{$endif}  try       // Have to be before creation of the connection     {$ifdef InLinux}       {$ifdef RasPi}       {$ifdef SQLDebug}DebugLn({$I %FILE%} + '->' +{$I %CURRENTROUTINE%} +'Using RasPi Connection');{$endif}         DBLibLibraryName := 'libsybdb.so.5';       {$else}       {$ifdef SQLDebug}DebugLn({$I %FILE%} + '->' +{$I %CURRENTROUTINE%} +'Using Linux X64 Connection');{$endif}         DBLibLibraryName := '/usr/lib/x86_64-linux-gnu/libsybdb.so.5.0.0';       {$endif}       {$else}       {$ifdef SQLDebug}DebugLn({$I %FILE%} + '->' +{$I %CURRENTROUTINE%} +'Using Windows Connection');{$endif}         DBLibLibraryName := 'sybdb';      {$endif}     {$ifdef SQLDebug}DebugLn({$I %FILE%} + '->' +{$I %CURRENTROUTINE%} +'TDMSQLCon -> DBLibLibraryName = ' + DBLibLibraryName);{$endif}     SQLCon := TMSSQLConnection.Create(self);     // Mssql     SQLTransaction:= TSQLTransaction.Create(SQLCon);     SQLCon.Transaction := SQLTransaction;     SQLCon.CharSet:= 'UTF8';     SQLCon.Options:=[scoApplyUpdatesChecksRowsAffected];     // common part     SQLCon.UserName := coUser;     SQLCon.Password := coPW;  finally     //  end;  {$ifdef SQLDebug}DebugLn({$I %FILE%} + '->' +{$I %CURRENTROUTINE%} +' end');{$endif}end;