Megosztás a következőn keresztül:


Completing a Conversation Between Databases

This tutorial is intended for users who are new to Service Broker, but are familiar with database concepts and Transact-SQL statements. It will help new users get started by showing them how to build and run a basic conversation between two databases on the same instance of the Database Engine.

What You Will Learn

This tutorial builds on the tasks that you learned in the tutorial Completing a Conversation in a Single Database. In this tutorial you will learn how to configure the conversation so that it runs between two databases on the same instance of the Database Engine.

The steps that you will follow in Lesson 2 are the same as those you followed in Lesson 1, with these exceptions:

  • You will create two databases: InitiatorDB and TargetDB. You will create all the initiator service and queue in the InitiatorDB and the target service and queue in the TargetDB.

  • You will create two copies of the message types and contacts, one in the InitiatorDB and the other in TargetDB. Both sides of the conversation must have access to message type and contract definitions that are identical.

  • You will set the TRUSTWORTHY database property to ON in the InitiatorDB. This is the simplest mechanism for enabling conversations between two databases when they are on the same instance of the Database Engine.

  • You will learn which statements must be run in each database to complete a conversation, and the sequence in which they must be run.

Messages are not transmitted across a network for conversations that have both ends in the same instance of the Database Engine. Database Engine security and permissions restricts access to authorized principles. Network encryption is not needed for this scenario.

This tutorial is divided into four lessons:

Requirements

To complete this tutorial, you should be familiar with the Transact-SQL language and using the Database Engine Query Editor in SQL Server Management Studio. You must have CREATE DATABASE, CREATE ANY DATABASE, or ALTER ANY DATABASE permissions to run this tutorial.

Your system must have the following installed:

  • Any edition of SQL Server 2005 or SQL Server 2008.

  • Either SQL Server Management Studio or Management Studio Express.

  • Internet Explorer 6 or a later version.

    Note

    When you review the tutorials, we recommend that you add the Next and Previous buttons to the document viewer toolbar. For more information, see Adding Next and Previous Buttons to Help.