Reputation: 1200
My knowledge on OLEDB is minimal at best. Is there a way to build a connection string to use a trusted Windows authentication rather than using User ID and Password?
Upvotes: 3
Views: 16381
Reputation: 4203
As MSDN states in the How To: Connect to SQL Server Using Windows Authentication in ASP.NET 2.0 article,
The connection string used with Windows authentication must include either the Trusted_Connection=Yes attribute, or the equivalent attribute Integrated Security=SSPI, as shown here.
So instead of User Id=...;
and Password=...;
you should include one of the options below in your connection string,
Upvotes: 1
Reputation: 73564
Yes. Here's an example for SQL Server 2008.
Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase; Trusted_Connection=yes;
If your database is something other than SQL Server 2008 (and the odds are probably pretty good that it's not), you can get just about any Connection String example from this site: http://www.connectionstrings.com/
or here http://www.carlprothman.net/Default.aspx?tabid=81
Upvotes: 3
Reputation: 2314
Since you didn't state what language you would be using the OLEDB call through I just posted some basic C# to do the trick.
using System.Data.OleDb;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString =
"Driver=SQLOLEDB;" +
"Data Source=ServerName;" +
"Initial Catalog=DataBaseName;" +
"Integrated Security=SSPI;";
conn.Open();
Upvotes: 1