# Using eXtremeSQL C++ Class McoSqlOpenParameters

> The sample api_sql_02_open_initililize demonstrates how to use the default open parameters and simple call `engine.open()` for an in-memory database. To manage a Persistent or Hybrid database (containing both persistent and transient classes), or to manage a database with multiple memory segments, an additional step is required to define memory devices and runtime caching and logging parameters. This is accomplished by setting McoSqlOpenParameters and passing these to the `McoSqlEngine.Open()` method:

>         int main()
>         {
>             McoSqlOpenParameters params;

>             // set MCO SQL parameters
>             params.databaseName = "persondb";
>             params.dictionary = persondb_get_dictionary();
>             params.mainMemoryDatabaseSize = MEMORY_DATABASE_SIZE;
>             params.mainMemoryPageSize = PAGE_SIZE;
>             params.diskDatabaseFile = "persondb.dbs";
>             params.diskDatabaseLogFile = "persondb.log";
>             params.diskCacheSize = DISK_CACHE_SIZE;
>             params.logType = REDO_LOG;
>             engine.open(params);

>             // Do normal database processing
>             engine.close();

>             return 0;
>         }

> The default values for McoSqlOpenParameters, which can be set by calling the `setDefaultValues()` method, are as follows:

>         void McoSqlOpenParameters::setDefaultValues()
>         {
>             databaseName = NULL;
>             dictionary = NULL;
>             mainMemoryDatabaseSize = 0;
>             mainMemoryDatabaseAddress = MCO_DATABASE_DEFAULT_MAP_ADDRESS;
>             maxTransactionSize = 0;
>             maxConnections = 100;
>             mainMemoryPageSize = 128;
>             hashLoadFactor = 100;
>             flags = DEFAULT_OPEN_FLAGS;
>             modeMask = 0;
>             savedImage = NULL;
>             diskDatabaseFile = NULL;
>             diskDatabaseLogFile = NULL;
>             diskDatabaseMaxSize = MCO_INFINITE_DATABASE_SIZE;
>             diskCacheMemoryAddress = 0;
>             diskCacheSize = 0;
>             diskPageSize = 4096;
>             streamReader = NULL;
>             stream = NULL;
>             remoteEngine = NULL;
>             redoLogLimit = MCO_DEFAULT_REDO_LOG_LIMIT;
>             logType = REDO_LOG;
>             defaultCommitPolicy = MCO_COMMIT_SYNC_FLUSH;
>             transSchedPolicy = MCO_SCHED_FIFO;
>             devices = NULL;
>             n_devices = 0;
>             tables = NULL;
>             n_tables = 0;
>             maxClasses = 0;
>             maxIndexes = 0;
>             maxDictionarySize = 0;
>             dictionaryFlags = 0;
>             maxTransTime = 0;
>             maxActivePages = 32;
>         }