A character string containing information required for establishing a connection to a server. It is a list of name/value pairs separated by semi-colons.
The information which must be supplied in the connection string depends both on the server being accessed and the database engine being used. With the
exception of the DBE information, DacSession objects do not actually use the information provided in the connection string. Instead, the information is
passed on to the server or ODBC/database driver. The following table lists some of the name/value pairs frequently found in connection strings. Please
consult the server's or driver's manual to learn which options it supports as part of the connection string.
Possible name/value pairs supported in connection strings
Name
Value description
DBE *)
The database engine for accessing the remote data source
The default value of the optional logical parameter <lDefault> is .T. (true). This causes the new DacSession object to be used as the default session object for the current thread. Passing .F. (false) causes the
default session to remain unchanged.
<cDBE>
A character string with the name of the DatabaseEngine to be used for the server connection. This parameter must be set to the string "ADSDBE".
<cServerDrive>
The drive letter of the mapped server drive on which the ADS server is running must be passed in <cServerDrive>.
Return
This method returns an object of the DacSession class.
Description
The method :new() creates a new instance of the DacSession class. If a connection string is assigned to the <cConnectString>parameter, the method also attempts to connect the object to the server specified. The method :isConnected()can be used to determine whether the connection was established successfully. Once the connection is no longer needed, it can be disconnected using the
method :disconnect().
Note that :new() supports two parameter interfaces. The second one is supported for backwards compatibility only and should no longer be used.
The default session is important for database operations programmed in command or functional style. USE database and DbCreate() are examples for such commands and functions which do not allow to select the session to be used. In this case, it is the default DacSession object which
forwards these requests to the server. A default session has thread-local scope. This means that each thread can have its own default DacSession object
in multi-threaded programs.
When no connection string is passed in the <cConnectString> parameter, the DacSession object returned does not manage a connection on its own. Such a session object is used to build a compound session which is
a session connected to multiple data sources. This is achieved by using the :addDataSource()method to add the data source object of other DacSession objects to the compound DacSession object.
Feedback
If you see anything in the documentation that is not correct, does not match your
experience with the particular feature or requires further clarification, please use
this form
to report a documentation issue.