Defining the Application Database
When you define a Notification Services application, you can define the application database name, the schema for application objects, and, if you are creating a new database, the specifications for the database. The application database stores event, subscription, and notification data, as well as application metadata.
A Notification Services application generates and distributes notifications from subscriptions and events. The event and subscription data, and the resulting notification data, are stored in a database. Notification Services also stores application metadata in this database.
You can use an existing database for the application database, or you can have Notification Services create a new database. If you use an existing database, you only need to define the database name and schema name. (If you specify other database properties, such as file names and file sizes, Notification Services ignores them.)
If you have Notification Services create a new database, you should fully define the database properties, such as file names, sizes, and locations. If you do not define the application database, Notification Services creates a new database for the application using the model database as a template. Unless you have customized the model database, these database settings might not provide the best performance for your application.
For recommendations on how to define an application database, see Database Considerations.
Using an Existing Database for Application Data
In SQL Server 2005, you can use any user database, including the instance database, for application data.
To use a specific database, you must specify the name of the database and a unique schema for all application objects. When you create the application (by creating the hosting instance), Notification Services creates the schema and all application tables, views, stored procedures, and other objects in that schema.
Because you can place more than one application in the same database, using a unique schema for each application separates objects of each application and avoids potential name conflicts with other database objects.
If the specified database does not exist when you create the instance of Notification Services, Notification Services creates a new database.
To specify the database and schema name
If you are defining an application using XML, specify the database name in the application definition file (ADF). If you are defining an application programmatically, use Notification Services Management Objects (NMO) to specify the database name.
- DatabaseName Element (ADF)
- SchemaName Element (ADF)
- DatabaseName property (NMO)
- SchemaName property (NMO)
Creating a New Database for Application Data
If you want Notification Services to create a new database for application data, you can do any of the following:
- Fully define the application database. You can specify the database name, schema name, filegroups, log files, default filegroup, and collation. If the database does not exist, Notification Services creates a new database using the specified properties and creates all application objects in the specified schema.
- Define the application database, specifying only a database name and schema name. If the database does not exist, Notification Services creates a new database with the specified name, creates the specified schema, and creates all application objects in the specified schema.
- Leave the application database undefined, specifying no database properties. Notification Services creates a new application database with the name <instanceName><applicationName> and creates all application objects in the dbo schema.
To define the application database
If you are defining an application through XML, specify the database properties in the application definition file (ADF). If you are defining an application programmatically, use NMO to specify the database properties.
Database Element (ADF)
Application Definition File Templates
Defining Notification Services Applications
Defining Event Classes
Defining Subscription Classes
Defining Notification Classes
Defining Event Providers