Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

March 27, 2002 12:00 AM

.NET Connection-String Keywords

SQL Server Pro
InstantDoc ID #24023
Rating: (3)

The SQL Server .NET data provider that's included in Visual Studio .NET introduces fundamental changes to the data-access mechanisms that you're accustomed to in OLE DB and ADO. The best place to begin learning about these changes is probably in the connection-string keywords that the SQL Server .NET data provider's SqlConnection object supports. The connection-string keywords are necessary for connecting your application to SQL Server. Although many keywords that the SqlConnection object uses are similar to the OLE DB connection-string keywords, they're not identical. Unlike OLE DB and ADO, which let you use properties to set many connection attributes, ADO.NET lets you set these keywords only in the connection string. Here are seven of the most important connection-string keywords.

7. PERSIST SECURITY INFO
This new keyword specifies whether security-sensitive information such as the password is returned to the application after a successful connection. The SQL Server OLE DB data providers always return this information. A value of true instructs the SqlConnection object to return the information; the default value is false.

6. ATTACHDBFILENAME, EXTENDED PROPERTIES, or INITIAL FILE NAME
These keywords all identify the full path and name of a file that will be attached as a SQL Server database when your application establishes the connection. You must use these keywords with the DATABASE keyword.

5. CONNECT TIMEOUT or CONNECTION TIMEOUT
These keywords specify the length of time in seconds to wait before terminating a connection attempt. The default value is 15 seconds.

4. CONNECTION LIFETIME
This connection-string keyword specifies the length of time in seconds to wait before destroying a connection that has returned to the connection pool. The default is 0.

3. INITIAL CATALOG or DATABASE
INITIAL CATALOG and DATABASE are among the most commonly used keywords. These keywords set the default database name for the current connection.

2. INTEGRATED SECURITY or TRUSTED_CONNECTION
For these keywords, a value of true or sspi specifies that the connection uses Windows authentication to connect to SQL Server. A value of false specifies that the connection uses mixed or SQL Server authentication, which requires the connection string to provide the UID and PWD keywords.

1. DATA SOURCE, SERVER, ADDRESS, ADDR, or NETWORK ADDRESS
Undoubtedly, these are the most essential connection-string keywords. You use them to specify the name or network address of a SQL Server instance to connect to.

Related Content:

ARTICLE TOOLS

Comments
  • GARRETT
    2 years ago
    Aug 09, 2010

    totally useless article. What's the syntax for specifying a workstation name to appear in SQL Profiler traffic?

  • Anonymous User
    8 years ago
    Dec 13, 2004

    I need a complete list of connection string key words and at least one example where SQLServer is on a different machine (as would happen in the real world). So far you site has been totally useless.

  • Anonymous User
    8 years ago
    Dec 12, 2004

    This article is useless. A complete list of attributes is needed.

  • George
    8 years ago
    Jun 01, 2004

    What does SSPI stand for?

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.