# Step 2: Opening Databases

> SDK sample `samples/csharp/Open` illustrates how to open a simple In-Memory database. The sample also demonstrates how to display runtime information by calling the Database method `GetRunTimeInfo()`. Please build and run the sample application and examine the source code. Note that the Database.Mode variable `mode` is set according to command line arguments:

>         Database.Mode mode = 0;

>         // Get config parameters from the command line
>         for (String s in args)
>         {
>             case "disk":
>                   mode|= Database.Mode.DiskSupport;
>                 break;
>             case "shm":
>                   mode|= Database.Mode.SharedMemorySupport;
>                 break;
>             case "debug":
>                 mode|= Database.Mode.DebugSupport;
>                 break;
>             case "mvcc":
>                 mode |= Database.Mode.MVCCTransactionManager;
>                 break;
>         }

> Then `mode` is used in the Database class constructor. This loads the appropriate runtime libraries dynamically. Once instantiated, the method `GetRunTimeInfo()` is called to obtain information about the currently loaded runtime libraries:

>         Database db;

>         db = new Database(mode);
>         Database.RuntimeInfo ri = db.GetRunTimeInfo();

> Database memory devices and parameters are initialized and passed to the Database method `Open()`:

>         Database.Device devs[];
>         Database.Parameters params = new Database.Parameters();

>         ...
>         params.memPageSize = PAGE_SIZE; // Memory page size
>         params.classes = new Class[] { OpenObj.class }; // List of classes which will be stored in eXremeDB database.
>         params.maxConnections = 10;
>         ...
>         devs = new Database.Device[1];
>         ...
>         devs[0] = new Database.PrivateMemoryDevice(Database.Device.Kind.Data, DATABASE_SIZE);
>         ...
>         db.Open("opendb", params, devs);

> For persistent databases, a minimum of four storage devices must be defined and the Database constructor must be called with `DiskSupport` enabled. Please see the Opening Persistent Databases page for further details.