IT tutorials
 
Technology
 

SQL Server 2012 : Client Connectivity - SQL Server Native Client Features

8/9/2013 9:06:07 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

The development community gains access to the new features of SQL Server 2012 through the SQL Server Native Client (SNAC). If the new features are not needed and managed code is a requirement for data access, ADO.NET can suffice.

Note

ADO.NET is an umbrella label applied to the .NET functionality that supports connections to a variety of data sources. Classes within this library supply the programmatic capability to create, maintain, dispose of, and execute actions against a database.

SQL Server Native Client OLE DB Provider Being Deprecated

The SQL Server Native Client OLE DB Provider is being deprecated in SQL Server 2012 and will no longer be available in future releases. Please note that only the SQL Server Native Client OLEDB Provider is being deprecated at this time and other OLE DB providers will still be supported until an official announcement is made on their respective deprecations.

The reasoning behind this move is to align with the industry for using ODBC as the standard for native relational data access. This shift not only allows for universal cross-application compatibility, but this allows developers to concentrate on one set of APIs for all their native client applications. This means that if you're developing for standalone SQL Server and Windows Azure SQL Database, or porting applications to Windows Azure for the first time, it's all built on the same API so the development transition is seamless.

Native Client Support for LocalDB

SQL Server 2012 introduced Microsoft SQL Server Express LocalDB, a lightweight execution mode of SQL Server Express that allows developers to connect to a SQL Server Engine to write and test Transact-SQL code without the hassle of having to manage a full instance of SQL Server.

Metadata Discovery

Thanks to updates to metadata discovery in SQL Server 2012, applications using SQL Server Native Client will now get back column or parameter metadata from a query execution identical to or compatible with the metadata format you specified.

When developing applications that use the SQL Server Native Client while connected to an earlier version of SQL Server, the metadata discovery functionality corresponds to the version of the server.

High-Availability/Disaster Recovery Support

When a database connection is established to a SQL Server 2012 server, the failover partner is automatically identified in a mirrored scenario. This information is used by SNAC to transparently connect to the failover partner if the principal server fails. The failover partner's identity can also be supplied as an optional parameter in the database connection string using the Failover_Partner keyword.

Additionally, you can also use SNAC to take advantage of the new AlwaysOn Availability Groups feature built on the mirroring technology. Applications using SNAC can connect to the primary replica of a given availability group either via a network name or connection strings much like you do with mirroring.

Applications connecting to an availability group using SQL Server Native Client can connect using an availability group listener, which is a virtual network name for the availability group. This concept should be familiar if you've ever set up a cluster and had to configure a virtual name for the cluster.

Note

If the connection to the principal server fails for a transaction, and if a transaction is involved, it will be rolled back. The connection must be closed and reopened to access the failover partner, and then any data work must be reapplied. The failover connection is automatic as long as the failover partner's identity is a part of the connection object supplied from either the connection string or a prior successful connection to the server before it went down.


Improved Date/Time Support

SQL Server 2008 introduced the distinct date and time data types. These distinct data types provide much more flexibility for application developers when dealing with date and time types.

The distinct time type offers precision accurate up to 100 nanoseconds. This precision can be accessed via new types in SNAC: DBTYPE_DBTIME2 for OLE DB providers and SQL_SS_TIME2 for ODBC providers. If an application is written to use time with no fractional seconds, you can use time(0) columns. Precision of this magnitude can be extremely useful in process control and manufacturing applications that require that level of precision.

Other time-related support available is the ability to use date-time values with timezone information. This feature is supported through the use of DBTYPE_DBTIMESTAMPOFFSET for OLE DB and SS_TIMESTAMPOFFSET for ODBC types.

Accessing Diagnostic Information in the Extended Events Log

Another new feature in SNAC 11 is that data access tracing has been updated to make it easier to get diagnostic information about connection failures from the connectivity ring buffer and application performance information from the extended events log. 

In SQL Server 2012, connection operations via the SQL Server Native Client will generate a client connection ID. If connectivity fails, you can access the connectivity ring buffer and find the ClientConnectionID field to get diagnostic information about the session and the connection failure.

Note
Data access tracing is intended only for troubleshooting and diagnostic purposes and may not be suitable for auditing or security purposes.

ODBC Features

With SQL Server 2012, Microsoft has made a radical shift on its stance with regard to ODBC. As of this release, they have decided to push ODBC as the primary method of connectivity and will be deprecating OLEDB in future releases, although it's still available in SQL 2012. In this release, the SQL Server Native Client OLE DB provider is the first of the OLE DB providers that will be deprecated and will not be available in the next release of SQL Server; however, it will be supported for the life cycle of SQL Server 2012.

As for the ODBC provider itself, three new features were added to the ODBC support, which were also added to the standard ODBC in the Windows 7 SDK:

  • Asynchronous execution on connection-related operations
  • C Data Type Extensibility
  • Calling SQLGetData with a small buffer multiple times to retrieve a large parameter value

Multiple Active Result Sets (MARS)

SQL Server 2012 provides support for having multiple active SQL statements on the same connection. This capability includes being able to interleave reading from multiple result sets and being able to execute additional commands while a result set is open.

Microsoft guidelines for applications using MARS include the following:

  • Result sets should be short-lived per SQL statement.
  • If a result set is long-lived or large, then server cursors should be used.
  • Always read to the end of the results and use API/property calls to change connection properties.
Note
By default, MARS functionality is not enabled. Turn it on by using a connection string value — MarsConn for the OLE DB provider and Mars_Connection for the ODBC provider.

XML Data Types

Much like the current VarChar data type that persists variable character values, a new XML data type persists XML documents and fragments. This type is available for variable declarations within stored procedures, parameter declarations, and return types and conversions.

User-Defined Types

These types are defined using .NET Common Language Runtime (CLR) code. This would include the popular C# and VB.NET languages. The data itself is exposed as fields and properties, with the behavior being exposed through the class methods.

Large Value Types

Three new data types have been introduced to handle values up to 2 ˆ 31-1 bytes long. This includes variables, thus allowing for text values in excess of the old 8K limit. The data types and their corresponding old types are listed in Table 1.

Table 1 SQL Server 2012 Large Values Types

Large Data Types Prior Data Types
varchar(max) Text
nvarchar(max) Ntext
varbinary(max) Image

FILESTREAM Support

FILESTREAM is a feature that was introduced in SQL Server 2008 that allows you to store and access large binary values, either through SQL Server or by direct access to the Windows file system. Large binary values are considered any values larger than 2 gigabytes (GB). This feature allows SQL Server-based applications to store and manipulate unstructured data, such as images and documents, on the file system.

Handling Expired Passwords

This feature of SQL Server 2012 enables users to change their expired password at the client without the intervention of an administrator.

A user's password may be changed in any of the following ways:

  • Programmatically changing the password such that both the old and new passwords are provided in the connection string
  • A prompt via the user interface to change the password prior to expiration
  • A prompt via the user interface to change the password after expiration
Best Practice

If the old and new passwords are supplied on the connection string, then ensure that this information has not been persisted in some external file. Instead, build it dynamically to mitigate any security concerns.

Snapshot Isolation

The snapshot isolation feature enhances concurrency and improves performance by avoiding reader-writer blocking.

Snapshot isolation relies on the row versioning feature. A transaction begins when the BeginTransaction call is made but is not assigned a sequence transaction number until the first T-SQL statement is executed. The temporary logical copies used to support row versioning are stored in tempdb.

Note
If tempdb does not have enough space for the version store, then various features and operations, such as triggers, MARS, indexing, client executed T-SQL, and row versioning will fail, so ensure that tempdb has more than enough space for anticipated uses.
 
Others
 
- SQL Server 2012 : Client Connectivity - Enabling Server Connectivity
- Windows 7 : Add Someone to Your Contacts
- Windows 7 : Send an E-mail Message
- Windows 7 : Configure an E-mail Account
- Windows 7 : Install Windows Live Essentials Programs
- Deploying Windows Server 2012 (part 6) - Postinstallation tasks
- Deploying Windows Server 2012 (part 5) - Troubleshooting installation
- Deploying Windows Server 2012 (part 4) - Performing additional administration tasks during installations
- Deploying Windows Server 2012 (part 3) - Installing Windows Server 2012 - Performing a clean installation, Performing an upgrade installation, Activation sequence
- Deploying Windows Server 2012 (part 2) - Installing Windows Server 2012 - Planning partitions, Naming computers, Network and domain membership options
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us