Database Reference
In-Depth Information
If you don't include the Integrated Security = true (or Integrated Security = sspi ) parameter in
the connection string, the connection defaults to SQL Server security, which uses a separate login and
password within SQL Server.
How to Use SQL Server Security
If you really did intend to use SQL Server security because that's how your company or department has
set up access to your SQL Server (perhaps because some clients are non-Microsoft), you need to specify
a user name and password in the connection string, as shown here:
thisConnection.ConnectionString = @"server = sqlexpress; user id = sa; password = xly2z3";
The sa user name is the default system administrator account for SQL Server. If a specific user has
been set up, such as george or payroll , specify that name. The password for sa is set when SQL Server is
installed. If the user name you use has no password, you can omit the password clause entirely or specify
an empty password, as follows:
password =;
However, a blank password is bad practice and should be avoided, even in a test environment.
Connection String Parameters for SqlConnection
Table 12-2 summarizes the basic parameters for the SQL Server data provider connection string.
Table 12-2. SQL Server Data Provider Connection String Parameters
Name
Alias
Default Value
Allowed Values
Description
Application Name
.Net SqlClient
Data Provider
Any string
Name of application
AttachDBFileName extended
properties , Initial
File Name
None
Any path
Full path of an attachable
database file
Connect Timeout
Connection Timeout 15
0- 32767
Seconds to wait to
connect
Data Source
Server , Address ,
Addr , Network
Address
None
Server name or
network address
Name of the target SQL
Server instance
Encrypt
false
true , false , yes , no Whether to use SSL
encryption
Initial Catalog
Database
None
Any database that
exists on server
Database name
 
 
Search WWH ::




Custom Search