Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » UltraLite - .NET Programming » UltraLite .NET 2.0 API reference


ULConnectionParms class

UL Ext.: Builds a connection string for opening a connection to an UltraLite database. The frequently-used connection parameters are individual properties on the ULConnectionParms object.

Visual Basic
Public Class ULConnectionParms
  Inherits Component
public class ULConnectionParms: Component

A ULConnectionParms object is used to specify the parameters for opening a connection (ULConnection.Open) or dropping a database (ULDatabaseManager.DropDatabase).

Leading and trailing spaces are ignored in all values. Values must not contain leading or trailing spaces, or a semicolon (;), or begin with either a single quote (') or a double quote (").

When building a connection string, you need to identify the database and specify any optional connection settings. Once you have supplied all the connection parameters by setting the appropriate properties on a ULConnectionParms object, you create a connection string using the ULConnectionParms.ToString. The resulting string is used to create a new ULConnection with the ULConnection(String) constructor or set the ULConnection.ConnectionString of an existing ULConnection object.

Identifying the database

Each instance contains platform-specific paths to the database. Only the value corresponding to the executing platform is used. For example, in the code below the path \UltraLite\mydb1.udb would be used on Windows Mobile, while mydb2.db would be used on other platforms.

' Visual Basic
Dim dbName As ULConnectionParms = new ULConnectionParms
dbName.DatabaseOnCE = "\UltraLite\mydb1.udb"
dbName.DatabaseOnDesktop = "somedir\mydb2.udb"

// C#
ULConnectionParms dbName = new ULConnectionParms();
dbName.DatabaseOnCE = "\\UltraLite\\mydb1.udb";
dbName.DatabaseOnDesktop = @"somedir\mydb2.udb";

The recommended extension for UltraLite database files is .udb. On Windows Mobile devices, the default database is \UltraLiteDB\ulstore.udb. On other Windows platforms, the default database is ulstore.udb. In C#, you must escape any backslash characters in paths or use @-quoted string literals.

If you are using multiple databases, you must specify a database name for each database. For more information, see AdditionalParms property.

Optional connection settings

Depending on your application's needs and how the database was created, you might need to supply a non-default ULConnectionParms.UserID and ULConnectionParms.Password, a database ULConnectionParms.EncryptionKey, and the connection ULConnectionParms.CacheSize. If your application is using multiple connections, you should provide a unique ULConnectionParms.ConnectionName for each connection.

Databases are created with a single authenticated user, DBA, whose initial password is sql. By default, connections are opened using the user ID DBA and password sql. To disable the default user, use the ULConnection.RevokeConnectFrom. To add a user or change a user's password, use the ULConnection.GrantConnectTo.

If an encryption key was supplied when the database was created, all subsequent connections to the database must use the same encryption key. To change a database's encryption key, use the ULConnection.ChangeEncryptionKey.

For more information, see UltraLite connection parameters.

See also

ULConnectionParms members
ULConnectionParms constructor
AdditionalParms property
CacheSize property
ConnectionName property
DatabaseOnCE property
DatabaseOnDesktop property
EncryptionKey property
Password property
UserID property
ToString method
UnusedEvent event