Client and Server Database Connections


The following information is included as reference for existing applications that support offline scenarios only. For developing new applications, please see Architecture and Classes for Database Synchronization.

Sync Framework makes at least two connections during synchronization, to the client and the server. Additional connections are required in N-tier and service-based architectures. Sync Framework makes these connections by using ADO.NET. Be aware of the following behavior:

  • For performance reasons, the DbServerSyncProvider uses ADO.NET connection pooling. Connection pooling can retain a physical connection to a SQL Server database even if synchronization is not running. Typically, this is not an issue. However, if you must drop the physical connection, call ClearPool.

  • Connection strings that are passed to DbServerSyncProvider must always include the name of the database from which tables will be synchronized, as shown in the following example:

    Data Source=localhost; Initial Catalog=AdventureWorks; Integrated Security=True;
  • Connection strings that represent a database and are passed to SqlSyncProvider are typically of the following general form:

    Server=tcp:<server name>;Database=<database name>;User ID=<user name>;Password=<myPassword>;Trusted_Connection=False;Encrypt=True;

    The connection string for a database can be retrieved from the Windows Azure Developer Portal by selecting the database, clicking the Connection Strings button, and copying the ADO.NET connection string to the clipboard. You might also need to add a rule to the Firewall Settings for your account to allow access to the database.

For information about how to secure connections, see Security Considerations.

Vea también


Considerations for Offline-Only Synchronization