Mac OSX ODBC to MSSQL

Hi to all,
I would like to connect to a Microsoft sql server via Xojo ODBC driver (I don’t want to use paid plugins) from my Mac. This is my situation: Xojo web application, Mac os 12.4.7, Xojo 2024R1, Ms-SQL Server 2019. I installed the Microsoft odbc drivers (https://learn.microsoft.com/it-it/sql/connect/odbc/linux- mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver16) everything is ok, if from the command line I try to connect to the sql server (sqlcmd -S 192.168.1.40 -U sa -P XXXXX -C) everything works (Exit:[SQL_SUCCESS]). Now I’m trying to connect via Xojo, the code and connection string I’m using is this:

Var myDatabase as new ODBCDatabase
myDatabase.DataSource = “Driver={ODBC Driver 18 for SQL Server};Server=192.168.1.40;Database=xojo_db;UID=sa;PWD=XXXXX;Encrypt=No;TrustServerCertificate=Yes;”
myDatabase.Connect

When I run the application the browser opens and shows the popup message “Connection problem. We are having trouble communicating with the server. Please wait a moment while we attempt to reconnect.”, the Xojo IDE closes the runtime execution and only the source mask remains without any error messages.

Does anyone have any suggestions on how to understand where the problem might be? Maybe in the connection string?

Thank you

I have a desktop application that connects to the ODBC server from macOS and Windows.
In macOS, I have been using the driver from ActualTech for years.
In Windows, I use the driver from Microsoft. I cannot get a working connection with the ODBC driver 18 either.
It looks like this for me:

#If TargetMacOS then
  odbcDB.DataSource = "Driver={Actual SQL Server};Server=192.168.1.2;Database=MyDatabase;UID=dba;Pwd=xyz"
#Else
  odbcDB.DataSource = "Driver={ODBC Driver 17 for SQL Server};Server=192.168.1.2;Database=;UID=dba;Pwd=xyz;"  
#EndIf

I can make the connection with

{SQL Server}

or with

{ODBC Driver 17 for SQL Server}

to establish the connection.
With

{ODBC Driver 18 for SQL Server}

I cannot establish a connection in Windows either. I don’t know why this is the case.

Hi Michael,
thanks for your feedback, the windows configuration works correctly for me too with the odbc drivers. The strange thing is that although the Microsoft drivers work on OSX (with sqlcmd command the connection and database management works well) but it is not possible to use these drivers from xojo, and all Xojo users must purchase other software/licenses. I hope some other user has the solution. I’ll try to open a ticket with Xojo and see if they can help us. Thanks again. Oscar

1 Like