Is there a way to have Excel connect to Sql Server using the current user's network windows authentication (trusted connection/integrated security)? I don't want to rely on a sql login or have a uid/password in my code.
+1
A:
Driver={SQL Native Client};server=servernamehere;database=dbnamehere;Trusted_Connection=yes;
http://www.sqlstrings.com/SQL-Server-connection-strings.htm
http://www.connectionstrings.com/sql-server
Try this one:
Provider=sqloledb;Data Source=myServerName;Initial Catalog=myDatabaseName;Integrated Security=SSPI
Cade Roux
2009-10-15 17:06:49
Tried that already. Doesn't work from VBA.
notnot
2009-10-15 19:19:39
What Data Access component are you using?
Cade Roux
2009-10-15 20:34:53
ADODB.Connection
notnot
2009-10-19 14:57:08
+1
A:
See: http://www.connectionstrings.com/
Especially http://www.connectionstrings.com/sql-server-2005, for example:
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
or any other suitable connection string you find there.
Tomalak
2009-10-15 17:07:15