Creating Databases and Namespaces

  Previous topic Next topic  

At a minimum 2 databases are required. For development 3 databases are required. We will discuss about minimum requirements first and finally what else is required if we need to compile server-side CacheRDD code specific to any other target OS. Cache provides the server for almost all OS's though for trial purposes they have limited it to Windows, Mac-OS, Linux Suse only. For more details you can visit http://www.intersystems.com.

The first database is called "CACHERDD". The name of this database cannot be changed. This database will contain server-side CacheRDD specific object (executable) code. This database will never hold any external data whatsoever. CacheRDD client will never attempt to create/open any tables in this database. It will be of 1 MB in size and will never be subject to Journalling.

The second database will hold the tables created through your application. This database can have any name. As a professional point-of-view it should be named after your application identity. For example I use the name "VOUCH". For illustration purposes also I have used the name "VOUCH" for this database.

The 3rd database is also identical to CACHERDD but with one exception that it can have any name. I use "RDDSOURCE" for clarity point of view, and is also used and referenced in subsequent documentation. You can skip it if you only plan to consume one provided with repository.

 

Click on Cache cube in system-tray and click on "Management Portal".

Default browser will present you with log-in screen. After logging-in you will see the screen as below:

Click on "System Administration" then "Configuration" then "System Configuration" and you will end-up to the following screen.

Click on "Local Databases" witch will lead to following screen. Here you can see all databases created by Cache installation itself. Click on "Create New Database".

It is a good practice to separate the data folder from installation folder. For documentation purposes I choose to use "CacheDatabases". Create this folder, and select via <Browse> button. Then enter name of the database. "CACHERDD" will be automatically added to the string of Database directory. Press <Next>.

Until we learn more how Cache implements databases, chosse to go with default settings. Press <Next>.

For CACAHRDD database we have to keep the Initial Size == 1 MB. We only have few kbytes of code. Also set "Journal Globals" to "No". This database has nothing more than object RDD code. Press <Next>.

Presented screen shows nothing more than defined settings on previous pages. Verify and press <Finish>.

The following page will display the list of all databases including "CACHERDD". Cache defined default databases reside in {Cache installation folder}\mgr\. We decided to keep our databases in a separate, isolated folder, CacheDatabases. CACHERDD database is defined to reside in \CacheDatabases\CURACAO.

 

Cache implements a protocol where physical databases are manipulated via some logical representation which they call "NAMESPACE". Physical databases are attached to one or more NAMESPACEs. Application code refers to NAMESPACEs only. This is an important feature and is highly useful for large deployments. From RDD's point-of-view we should not be worrying about its extended usage other than what is relevant to our implementation.

We will define NAMESPACEs exactly with the same name as we defined databases. For example, for CACHERDD database we will define CACHERDD namespace, and so forth.

Steps below will lead us to explore how it is done. Return to <Home><System Administration><Configure><System Configuration> and click on <NameSpaces>.

Presented page will display all available NAMESPACEs. Click on <Create New Namespace>.

Presented fields are self-explanatory. Provide CACHERDD in <Name of the namespace> (upper cased). Keep <Copy from> empty. Choose CACHERDD for <Select an existing database for Globals> from the dropdown list. Do the same for <...Routines> also.

The filled-in form would look like the following. Then click on <Save>.

The presented screen will list all namespaces including the one we just created.

 

We just created our first database and its corresponding namespace. Repeat the same process for our other two databases, RDDSOURCE and VOUCH. RDDSOURCE will be exactly identical to CACHERDD, i.e., 1 MB - Journalling No. But the database which will host application tables, in our case VOUCH will have these properties: 1000 MB - Journalling Yes. I have tentatively choose to give it initial size of 1 GB, but you are free to set it up to the estimated value for data your application will generate for a given client. And do not worry if you choose to define it too less. Cache automatically expands the size of the database if there arrives more data then it can accommodate for this value. TIP: it is advisable to estimate the size of your application data and reserve the space for it initially. When Cache expands database at its own, it may affect your application's performance for some times.

Once we are done with creating all three databases and namespaces, Cache's management portal should reflect them as such:

And these are the contents of \CacheDatabases\ folder:

And these are contents within all above folders.