company logo

DataSource :: initialize - Initialize data source

The function can be called in order to initialize a data source from default option variables or options provided via a configuration or ini-file. Initializing the data source will close the data source ( close() ) and reset all data source properties. When handles are still opened, those are closed before initializing.

Usually, this function needs not to be called, since the open function usually initializes the data sources as well. In order to change options read from the configuration file, the data source can be initialized, updated and opened afterwards.

// initialize application and data source

  ds.initialize("c:/temp/myAppl.ini","Test",ConsoleApplication);

    ...       // update options as required

  ds.open();  // open data source

Implementation overview

Implementation details

  1. Initialize windows application from ini-file
    DataSource  :: initialize ( odaba::String &sDataSourceName )

    The data source will be initialized from the option section with the name passed in sDataSourceName . Options must have been initialized before by calling odaba ::initializeApplication() or initializeOptions() . The data source name to refer to an option section in the application configuration file or to a valid data source name defined in the data catalog of the application.

    When the data source could not be initialized, the function throws an exception. The data source handle remains as initialized data source handle.

    • sDataSourceName - Data source name

      The name of the data source refers to a section in a configuration or ini-file or to a data source defined in the data catalog defined for the application. Other data source variables are set from the data source definition referred to by the data source name.

  2. to list
  3. Initialize console application from ini-file
    DataSource  :: initialize ( odaba::String &sIniFile, odaba::String &sDataSourceName )

    The data source will be initialized from the option section with the name passed in sDataSourceName . The data source name to refer to an option section in the configuration file passed in sIniFile or to a valid data source name defined in the data catalog of the application.

    When the data source could not be initialized, the function throws an exception. The data source handle remains as initialized data source handle.

    • sIniFile - Path to ini-file location

      The path may contain any type of folder separator ('/' or '\'). Folder separators will be converted according to the conventions of the target system.

      In order to pass no ini-file, an empty string ( String() ) has to be passed.

    • sDataSourceName - Data source name

      The name of the data source refers to a section in a configuration or ini-file or to a data source defined in the data catalog defined for the application. Other data source variables are set from the data source definition referred to by the data source name.

  4. to list
  5. Initialize data source handle
    DataSource  :: initialize (  )

    The function completely resets the data source properties, which might be useful when reusing the data source handle later on.

  6. to list