Question

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.

Was it helpful?

Solution

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=SSPI part of the connection string. That should do the trick.

OTHER TIPS

You cannot use sql server integrated authentication with linux, you have to use sql server authentication

While not a direct answer to your question, this site is useful for almost any connection string question: http://www.connectionstrings.com/.

At the risk of sounding like a commercial: It's your one-stop-shop for connection strings!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top