Declares a database. The Name parameter can then be used on DCLDISKFILE's Db parameter and DCLMEMORYFILE's DbDesc parameter.
DCLDB
Name (Database name in code)
DbName (Actual Database name)
Access (*PRIVATE | *PUBLIC | *PROTECTED | *INTERNAL)
Shared (*NO | *YES)
Required. A character expression containing the name to call your database in code.
For a listing of the Database Class members, click here.
Optional. A character expression containing the name of the actual database.
Optional. The type of access to the member. *PRIVATE is the default.
*PRIVATE (default) - access to the database is accessible only from within their declaration context, including from members of any nested types, for example from within a nested procedure or from an assignment expression in a nested enumeration.
*PUBLIC - access to the database is accessible from anywhere within the same project, from other projects that reference the project, and from an assembly built from the project.
*PROTECTED - access to the database is accessible only from within the same class, or from a class derived from this class.
*INTERNAL - access to the database is accessible from within the same project, but not from outside the project.
Shared
Optional. Shared specifies whether or not this database connection object is to be shared. *NO is the default, which is the recommended option.
*NO (default) - this database connection object will not be shared (recommended).
*YES - this database connection object will be shared (not recommended).
Since a shared database connection is not thread safe, defining the connections
as a shared member implies that the program will have to ensure that only one
thread utilizes the connection at a time. Since the connection is used any time
there is file I/O activity on files opened with this connection, or when
programs are called using this connection, maintaining ‘only one thread’
can become challenging for the program. The program can employ a Semaphore,
AutoResetEvent or a Monitor (from System.Threading) to coordinate access to the
object utilizing the shared database connection. Since ASP.NET operates on a
multithreaded engine, using shared connections in a web application or web
service is particularly challenging.
You must specify the Name parameter, which is the name to call your database in code.
The DbName parameter is optional and is the name of the actual database you are declaring.
Use CONNECT to create a connection to a database, and DISCONNECT to close a database connection.
To 'load' the contents of the registry for a particular database name, set the DbName property of the database object declared with DCLDB. If a database name exists with the name, values such as server, label, and user, etc., become current and available through properties of the object.
You can use the CreateName method to take all the current values of the database name, except for the name itself, and creates a new 'Database Name' in the registry with the name given in NewName.
You can use the UpdateName method to write the current values of the database name object as the new values of the database name in the registry.
There are two methods which are Shared. These methods don't affect the current values of the database object.
Because ASNA.DataGate.Client is a managed object, you should never refer to a dclDB object in Finalize.
Be careful when setting the Shared parameter to *Yes; thus sharing a single connection to the database. Since a shared database connection is not thread safe, defining the connections as a shared member implies that the program will have to ensure that only one thread utilizes the connection at a time. Since the connection is used any time there is file I/O activity on files opened with this connection, or when programs are called using this connection, maintaining ‘only one thread’ can become challenging for the program. The program can employ a Semaphore, AutoResetEvent or a Monitor (from System.Threading) to coordinate access to the object utilizing the shared database connection. Since ASP.NET operates on a multithreaded engine, using shared connections in a web application or web service is particularly challenging.
CONNECT
CreateName
Method
DbName Property
DeleteName Method
DISCONNECT
UpdateName Method
GetNames Method
Database Class
Database Class Members