company logo

DataSource :: connect - Connect DataSourceHandle to server

The function connects the client handle of the data source to a server. In order to connect to a server database,server name (serverName) and port number (serverPort) must be set for the data source before calling this function.

When the data source client is connected to a server and server name and port do not match the connection parameters of the connected client, a new client is created for the data source handle and connected to the server.

When no server is defined, i.e. when a local data base is to be accessed, the function will not check the server connection and returns normally.

Before connecting, the data source is closed (close()) when being opened. This includes closing all opened access handles.

Implementation overview

Implementation details

  1. Connect data source with client
    DataSource  :: connect ( odaba::Client &cClient )

    The function sets the client handle passed in rClient as client handle for the data source. The client handle passed in rClient has to be a valid client handle. Otherwise, the function will throw an exception.

    • cClient - Client handle

      The client handle refers to an (usually) opened ODABA client. Calling functions with invalid client handles may cause an exception. For checking the client handle, isValid() can be called.

  2. to list
  3. Connect to main client
    DataSource  :: connect (  )

    The function tries to connect with the client handle currently set in the data source. When no client is set for the data source, the main client is used as client handle.

  4. to list