ODBC.DataSource

So feeling incredibly stupid today so maybe it’s just time to go binge watch a series or something but I can’t seem to figure out how to connect to a MS SQL Server database via the ODBC plugin. I’ve purchased and installed the SQL Server ODBC driver from Actual Technologies and I’ve been able to test connect to it. Connection panel below:

So what should my ODBC datasource be set to in code?

Driver={MS SQL Server}; Server=172.16.25.144; Database=ActiveRecord; UID=sa

Does not work so I must be missing something pretty simple. This is under DSN. Would be it better under System DSN or does it matter? For this case it will only ever be the single user ever working with it.

When I try to connect, the error message is: Unable to connect to the database. [iODBC][Driver Manager]dlopen({MS SQL Server},6): image not found.

Driver={MS SQL Server}

I would have expected

Driver={SQL Server}

But if you have created an actual DSN, don’t you connect to the DSN by name?

DSN={MS SQL Server};

Yeah, none of those worked either.

dang. :slight_smile:

On Mac (10.9 with Actual DSN) I use:

GRP_DB.DataSource = "DSNNAME" GRP_DB.UserName = "mydb" GRP_DB.Password = "mypassword"

This also works on Mac (DSN-less connection):

GRP_DB.DataSource = "Driver={Actual SQL Server};Server=192.168.242.20;Database=mydb;UID=sa;Pwd=mypassword"

On W32:

ConnString = "Driver={SQL Server};Server=" + db_address + ";Database=W32DSNName;UID=" + db_user + ";Pwd=" + db_password

That did it! Much thanks, Tanner.