HRÓÐÓLFR
HRÓÐÓLFR

Reputation: 5992

SQL Server Database Connection String

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.

Upvotes: 0

Views: 3983

Answers (3)

Moo-Juice
Moo-Juice

Reputation: 38800

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.

Upvotes: 2

James Hill
James Hill

Reputation: 61832

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!

Upvotes: 1

ADIMO
ADIMO

Reputation: 1117

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

Upvotes: 4

Related Questions