Can anyone offer any instructions for accessing an SQL Server DB on a Mac using the provided MS SQLServer Plugin from XOJO?
Is there a driver than needs to be installed?
Can anyone offer any instructions for accessing an SQL Server DB on a Mac using the provided MS SQLServer Plugin from XOJO?
Is there a driver than needs to be installed?
Hi!
Yes you need a driver. I use the “SQL Server & Sybase” driver of Actualtech.com .
XOJO’s MSSQLServerPlugin.xojo_plugin can be used but is obsolete. XOJO recommends to use ODBCPlugin.xojo_plugin.
I use ODBC access under macOS and Windows.
However, reading and writing BLOB fields in MSSQL is currently not possible in macOS (Issue #76243).
In my experience, BIT fields do not work at all. I therefore use TINYINT.
There is supposed to be a free driver for macOS from Microsoft?
// Verbindung zum Microsoft SQL-Server aufnehmen
if iv_host = "" or iv_user = "" or iv_password = "" then
return false
end if
odbcDB = new ODBCDatabase
odbcDB.host = iv_host
//Beispiele:
//Mac: DataSource = "Driver={Actual SQL Server};Server=192.168.242.20;Database=mydb;UID=sa;Pwd=mypassword"
//Win: ConnString = "Driver={SQL Server};Server=" + db_address + ";Database=W32DSNName;UID=" + db_user + ";Pwd=" + db_password
#If TargetMacOS then
odbcDB.DataSource = "Driver={Actual SQL Server};Server="+iv_host+";Database="+iv_DatabaseName+";UID="+iv_user+";Pwd="+iv_password
#Else
'odbcDB.DataSource = "Driver={SQL Server};Server=" +iv_host+";Database="+iv_DatabaseName+";UID="+iv_user+";Pwd="+iv_password
odbcDB.DataSource = "Driver={ODBC Driver 17 for SQL Server};Server="+iv_host+";Database="+iv_DatabaseName+";UID="+iv_user+";Pwd="+iv_password+";"
#EndIf
'odbcDB.UserName = iv_user
'odbcDB.Password = iv_password
odbcDB.Timeout = 5
odbcDB.SetConnectionAttribute(ODBCConstant.SQL_LOGIN_TIMEOUT,5)
try
odbcdb.Connect()
catch Error as DatabaseException
MyMessage = Error.Message
return false
end Try
Microsoft only recommend using the ODBC driver to connect to SQL Server. They have stopped working on the library that the Xojo plugin depended upon.
According to this Microsoft page the ODBC driver is available via Homebrew, which is a free package manager for macOS.