Udostępnij za pośrednictwem


Implementing a Connection Class for a Data Processing Extension

The Connection object represents a database connection or similar resource and is the starting point for users of a SQL Server Reporting Services data processing extension. It represents connections to database servers, though any entity with similar behavior can be exposed as a Connection.

To implement a Connection object, create a class that implements IDbConnection and optionally implements IDbConnectionExtension.

In your implementation, you must ensure that a connection is created and opened before commands can be executed. Ensure that your implementation requires clients to open and close connections explicitly, rather than having your implementation open and close connections implicitly for the client. Perform your security checks when the connection is obtained. Requiring an existing connection for the other classes in your SSRS data processing extension will then ensure that security checks are always performed when working with your data source.

The properties of the desired connection are represented as a connection string. It is strongly recommended that SSRS data processing extensions support the ConnectionString property using the familiar name/value pair system defined by OLE DB.

Note

Connection objects are often resource-intensive to obtain, so you may want to consider pooling connections or other techniques to mitigate this.

IDbConnection inherits from IExtension. You must implement the IExtension interface as part of your connection class implementation. The IExtension interface enables a class to implement a localized extension name and to process extension-specific configuration information stored in the Reporting Services configuration file.

Your Connection object contains the LocalizedName property through its implementation of IExtension. It is strongly recommended that Reporting Services data processing extensions support the LocalizedName property, so that users encounter a familiar, localized name for the extension in a user interface, such as Report Manager.

IExtension also enables your Connection object to retrieve and process custom configuration data stored in the RSReportServer.config file. For more information about processing custom configuration data, see the SetConfiguration method.

The class that implements IExtension is not unloaded from memory when the rest of your data processing extension classes are unloaded. Because of this, you can use your Extension class to store cross-connection state information or to store data that can be cached in memory. Your Extension class remains in memory as long as the report server is running.

You can extend your Connection class to include support for credentials in Reporting Services by implementing IDbConnectionExtension. When you implement the IntegratedSecurity, UserName, and Password properties of the IDbConnectionExtension interface, you enable the Integrated Security check box and Username and Password text boxes of the Data Source dialog in Report Designer. This enables Report Designer to store and retrieve credentials for data sources that support authentication. The credentials are stored securely and used when rendering reports in preview mode.

Note

Implementing IDbConnectionExtension implicitly requires you to implement the members of the IDbConnection and IExtension interfaces. For a sample Connection class implementation, see File Share Data Processing Extension Sample.

See Also

Reference

Reporting Services Extension Library

Other Resources

Reporting Services Extensions
Implementing a Data Processing Extension

Help and Information

Getting SQL Server 2005 Assistance