Trusted connection means if you're using integrated security or not (you can use the integrated security property in stead. Trusted connection (or integrated security on) means the connection will be made using the Windows account the code is currently
running under. Trusted connection false means you will be supplying your own user id and password that the connection will use, and that will then use SQL Server security rather than Windows integrated security.
I'm afraid I no longer use this forum due to the new point allocation system.
A trusted connection is used if you're connecting to the database without providing a user name and password.
For example, if you are connecting via a Data Source Name, and the DSN contains the user ID you're using to connect, then your trusted connection is true.
If you are providing a user name and password as part of your connection string, then trusted connection is false.
If you specify a trusted connection in your connection string, whatever user name and password you pass to the database server will be ignored. In that case, your SQL Server needs to be configured to allow for trusted connections, which means either using
the sa account in SQL Server or using Windows Authentication to connect to the server.
So, it's a trusted connection if:
You're connecting via a DSN that contains the relevant login credentials.
You're connecting via Windows Authentication.
You've configured your SQL Server to allow remote connections via the sa account (which is a terrible idea).
Thanks for the replies. I am trying to pass Uid/Pwd explicitly so i have declared trusted_connection = false; Is it necessary to place the trusted_connection = false or i can remove the property from the connection string.
Yes, false is the default value so this is not needed and you can remove that from your connection string. It could have been quicker to just try rather than to ask in a forum ;-)
Member
80 Points
52 Posts
When to use Trusted_Connection is equal to False
Jun 11, 2014 03:17 PM|X-treme|LINK
Can someone guide me when to use the trusted_connection=false; in the connection string.
prαвír kumαr вαsαk .....
Application Developer
All-Star
37441 Points
9076 Posts
Re: When to use Trusted_Connection is equal to False
Jun 11, 2014 03:22 PM|AidyF|LINK
Trusted connection means if you're using integrated security or not (you can use the integrated security property in stead. Trusted connection (or integrated security on) means the connection will be made using the Windows account the code is currently running under. Trusted connection false means you will be supplying your own user id and password that the connection will use, and that will then use SQL Server security rather than Windows integrated security.
Member
180 Points
58 Posts
Re: When to use Trusted_Connection is equal to False
Jun 11, 2014 03:28 PM|dougvdotcom|LINK
A trusted connection is used if you're connecting to the database without providing a user name and password.
For example, if you are connecting via a Data Source Name, and the DSN contains the user ID you're using to connect, then your trusted connection is true.
If you are providing a user name and password as part of your connection string, then trusted connection is false.
If you specify a trusted connection in your connection string, whatever user name and password you pass to the database server will be ignored. In that case, your SQL Server needs to be configured to allow for trusted connections, which means either using the sa account in SQL Server or using Windows Authentication to connect to the server.
So, it's a trusted connection if:
Otherwise, it's not trusted.
http://www.dougv.com/
http://www.dougv.net
Member
80 Points
52 Posts
Re: When to use Trusted_Connection is equal to False
Jun 11, 2014 04:19 PM|X-treme|LINK
Hi All,
Thanks for the replies. I am trying to pass Uid/Pwd explicitly so i have declared trusted_connection = false; Is it necessary to place the trusted_connection = false or i can remove the property from the connection string.
prαвír kumαr вαsαk .....
Application Developer
Member
180 Points
58 Posts
Re: When to use Trusted_Connection is equal to False
Jun 11, 2014 05:04 PM|dougvdotcom|LINK
You should add it, but in most connnection strings, if you omit a trusted connection value, the default is that it is not a trusted connection/
http://www.dougv.com/
http://www.dougv.net
All-Star
48570 Points
18082 Posts
Re: When to use Trusted_Connection is equal to False
Jun 11, 2014 05:07 PM|PatriceSc|LINK
Hi,
Yes, false is the default value so this is not needed and you can remove that from your connection string. It could have been quicker to just try rather than to ask in a forum ;-)
For further reference keep also the SqlConnection.ConnectionString documentation at http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx handy. It includes a description of most if not all SQL Server connection string keywords.
If "trying" means that you have a problem wiht your connection string, just directly post the error message you have.