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 ( 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 -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=;Database=xojo_db;UID=sa;PWD=XXXXX;Encrypt=No;TrustServerCertificate=Yes;”

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=;Database=MyDatabase;UID=dba;Pwd=xyz"
  odbcDB.DataSource = "Driver={ODBC Driver 17 for SQL Server};Server=;Database=;UID=dba;Pwd=xyz;"  

I can make the connection with

{SQL Server}

or with

{ODBC Driver 17 for SQL Server}

to establish the connection.

{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