TMSSQLConnection in MacOS Lazarus lazarus / 16-Databases ---------------------------------------------------------------------- spoofy · 2025-12-04 10:28 I am here in problem with Mac version of Lazarus (4.2 and 4.4). Working with one project which compiles good on Windows and Linux but on Mac there is not TMSSQLConnection which is important in this project. I know that the TSQLConnector option is maybe solution, but that requires too many changes to the entire project. Is there a reason why the mentioned component is not available in the Mac version of Lazarus? Thank you. ---------------------------------------------------------------------- wp · 2025-12-04 10:42 I am neither an expert in macOS nor in MSSqlServer. But looking at the registration unit of the SqlDB package ("registersqldb.pas" in (lazarus)/components/sqldb) this can be seen: 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 {$IF FPC_FULLVERSION >= 20601}  // MS SQL Server and Sybase ASE connectors were introduced in the FPC 2.7 development branch,  //  and backported to 2.6.1. Operating systems should match FPC packages\fcl-db\fpmake.pp        {$IF DEFINED(BEOS) OR DEFINED(HAIKU) OR DEFINED(LINUX) OR DEFINED(FREEBSD) OR DEFINED (NETBSD) OR DEFINED(OPENBSD) OR DEFINED(WIN32) OR DEFINED(WIN64)}            {$DEFINE HASMSSQLCONNECTION}             {$DEFINE HASSYBASECONNECTION}       {$ENDIF}{$ENDIF}  This condition does not define "HASMSSQLCONNECTION" for macOS (DARWIN). It's been a very long time since FPC 2.7 was "new", a lot has changed since then. Why don't you just extend the {$IF by an "OR DEFINED(DARWIN)", rebuild the IDE and see what happens. If it goes wrong, just restore the old state and rebuild the IDE again. If it works, on the other hand, you found an out-of-date condition in the registration unit, and you should file a bug report. ---------------------------------------------------------------------- Zvoni · 2025-12-04 11:14 I'm trying (and failing!) to wrap my mind around the fact, why a Mac- User would voluntarily try to connect to a Microsoft-SQL-Server..... ---------------------------------------------------------------------- spoofy · 2025-12-04 14:59 This is a multiplatform database management client that, among other things, has the ability to connect to MSSQL. I have no problem removing that part of the code so that I can compile it, the question was more why it is available on Windows and Linux but not on Mac. Why shouldn't someone using Mac OS be able/need to connect to MS-SQL? ---------------------------------------------------------------------- Zvoni · 2025-12-04 15:02 Quote from: spoofy on December 04, 2025, 03:59:56 pmWhy shouldn't someone using Mac OS be able/need to connect to MS-SQL? Because it's a hassle just to install the Client-Driver? https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/install- microsoft-odbc-driver-sql-server-macos?view=sql-server-ver17 ---------------------------------------------------------------------- spoofy · 2025-12-04 15:10 Quote from: wp on December 04, 2025, 11:42:10 amI am neither an expert in macOS nor in MSSqlServer. But looking at the registration unit of the SqlDB package ("registersqldb.pas" in (lazarus)/components/sqldb) this can be seen: 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 {$IF FPC_FULLVERSION >= 20601}  // MS SQL Server and Sybase ASE connectors were introduced in the FPC 2.7 development branch,  //  and backported to 2.6.1. Operating systems should match FPC packages\fcl-db\fpmake.pp        {$IF DEFINED(BEOS) OR DEFINED(HAIKU) OR DEFINED(LINUX) OR DEFINED(FREEBSD) OR DEFINED (NETBSD) OR DEFINED(OPENBSD) OR DEFINED(WIN32) OR DEFINED(WIN64)}            {$DEFINE HASMSSQLCONNECTION}             {$DEFINE HASSYBASECONNECTION}       {$ENDIF}{$ENDIF}  This condition does not define "HASMSSQLCONNECTION" for macOS (DARWIN). It's been a very long time since FPC 2.7 was "new", a lot has changed since then. Why don't you just extend the {$IF by an "OR DEFINED(DARWIN)", rebuild the IDE and see what happens. If it goes wrong, just restore the old state and rebuild the IDE again. If it works, on the other hand, you found an out-of-date condition in the registration unit, and you should file a bug report. Unfortunately this fails because mssqlconn unit is not available in fpc for mac  . https://forum.lazarus.freepascal.org/index.php?topic=61558.0 ---------------------------------------------------------------------- spoofy · 2025-12-04 15:12 OK, thanks for the answers, now I understand the reason why the component is not in the mac version. Thanks ---------------------------------------------------------------------- zeljko · 2025-12-04 17:48 That works with mac, I had that problem more than year ago, but cannot remember what exactly I did in that case, but I remember that I've enabled mac in that define. I've installed dbeaver-ce on the mac, then wondered why it works with dbeaver and not in lazarus, bit of googling and found solution, but really cannot remember what I did (and that mac is far away from me atm, so no way to know what I've patched exactly). EDIT: maybe it was odbc , really don't know, but I know that I've succesfully connected and grapped data from mssql db on mac. ---------------------------------------------------------------------- PascalDragon · 2025-12-04 20:07 Quote from: Zvoni on December 04, 2025, 04:02:42 pmQuote from: spoofy on December 04, 2025, 03:59:56 pmWhy shouldn't someone using Mac OS be able/need to connect to MS-SQL? Because it's a hassle just to install the Client-Driver? https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/install- microsoft-odbc-driver-sql-server-macos?view=sql-server-ver17 FPC's TMSSQLConnection does not use the ODBC driver, but the FreeTDS library which is an Open Source implementation of the underlying protocol. In principle it should also be possible to compile that for macOS. Quote from: spoofy on December 04, 2025, 04:12:44 pmOK, thanks for the answers, now I understand the reason why the component is not in the mac version. If you get your hands on a FreeTDS binary for macOS you can just copy the mssqlconn unit from FPC's source and compile it yourself. ---------------------------------------------------------------------- zeljko · 2025-12-04 21:29 Well well, it is pretty possible that I've used freetds via macports Thanks @PascalDragon ---------------------------------------------------------------------- Zvoni · 2025-12-05 07:26 Quote from: PascalDragon on December 04, 2025, 09:07:37 pmFPC's TMSSQLConnection does not use the ODBC driver, but the FreeTDS library which is an Open Source implementation of the underlying protocol. In principle it should also be possible to compile that for macOS. Damn! Forgot that. Thx PD ---------------------------------------------------------------------- LacaK · 2026-02-23 13:01 If somebody confirms that TMSSQLConnection + FreeTDS works on macOS then of course TMSSQLConnection should be enabled also for DARWIN in "registersqldb.pas". (AFAICS enabled are those components that are tested and confirmed that they works ...)