I’m trying to write a program that will fetch data from a SQL Server database. The program is written on top of the .NET platform using C#. Furthermore, the program will be running on a Linux host (with mono). The problem that I am faced with is connecting to the database from the Linux machine, all of my code works fine from a windows host (since the server uses windows authentication), so my question is this: how can I connect to/authenticate with the SQL Server instance?
I’ve looked at http://www.mono-project.com/SQLClient, and it says to use a string similar to this: "Server=MyServer;Database=pubs;User ID=MyWindowsDomain\\MyWindowsUserid;Password=MyWindowsPassword;Integrated Security=SSPI" but that is not working. Is there maybe something I can do on the server (not likely that I’ll be allowed to, but as a last resort)?
Thanks.
As A. DIMO says, you cannot authenticate using integrated security on *NIX. It’s not a windows box.
In your SQL Server Management studio, create a login that uses SQL Server authentication and not Windows Authentication. Ensure it has the necessary writes on the database in question.
Next, remove the
Integrated Security=SSPIpart of the connection string. That should do the trick.