Reputation: 1961
I have a stand alone application that works great with a Local user account in MS SQL. When I try to use an active directory service account instead I appear to be running into problems.
It appears Microsoft want's the exe to run as the domain user service account which is not an option for me. Looking at alternatives, one person mentioned having main exe launching a second exe that does the work or having a local windows service.. neither of these are an option either. It feels like this is getting more complex then it needs to be.
Here is an example of the piece of code I am working with:
private void MakeConnection(){
string ServerNM = @"MyServer";
string Database = @"Test01";
string Username = @"testdomain\testuser";
string Password = @"testpass";
string connection_string = "Server=" + ServerNM
+ "; Database=" + Database
+ "; User ID=" + Username
+ "; Password=" + Password
+ "; Max Pool Size= 1000;";
try {
SqlConnection oSqlConnectionTest = new SqlConnection(connection_string);
oSqlConnectionTest.Open();
}catch(Exception oException){
MessageBox.Show("Error: " + oException.ToString());
}
}
Is this a real limitation or am I missing something?
Upvotes: 0
Views: 1837
Reputation: 2878
SQL Server does not accept domain accounts in the connection string for security reasons.
Upvotes: 1