Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

sql server connection to database Expand / Collapse
Author
Message
Posted Tuesday, February 12, 2013 4:03 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 9:33 AM
Points: 379, Visits: 451
if the following is in the connection string in an app.config file, the following will use the sql server login and not the
windows user login correct?

The following is a connection string that points to a sql server 2008 r2 database.

<connectionStrings>
<add name="RPCSS_DEVConnectionString"
connectionString="Data Source=dev;Initial Catalog=DEV2;User Id=myUsername;Password=myPassword;"
providerName="System.Data.SqlClient" />
</connectionStrings>

Also can you tell me if there is any way for the windows user name and password to be used when connecting to the
sql server 2008 r2 database? If so, can you tell me what the connection sting would be so I know to avoid that connection string?
Post #1419233
Posted Tuesday, February 12, 2013 5:53 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Thursday, December 18, 2014 8:51 PM
Points: 7,140, Visits: 12,763
wendy elizabeth (2/12/2013)
if the following is in the connection string in an app.config file, the following will use the sql server login and not the
windows user login correct?

The following is a connection string that points to a sql server 2008 r2 database.

<connectionStrings>
<add name="RPCSS_DEVConnectionString"
connectionString="Data Source=dev;Initial Catalog=DEV2;User Id=myUsername;Password=myPassword;"
providerName="System.Data.SqlClient" />
</connectionStrings>

Correct.

Also can you tell me if there is any way for the windows user name and password to be used when connecting to the
sql server 2008 r2 database? If so, can you tell me what the connection sting would be so I know to avoid that connection string?

Not via the connection string. What you can do is create a new thread under a different security context (lookup WindowsIdentity) and to create the new context you will supply a Windows Account's user and password. Then, on that thread running as the different account you can use a connection string that is setup to use Windows Authentication and it will leverage that user's account to make the connection, not the account that spawned the new thread.


__________________________________________________________________________________________________
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato
Post #1419254
Posted Wednesday, February 13, 2013 8:01 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 9:33 AM
Points: 379, Visits: 451
Thanks!
Post #1419538
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse