next up previous contents
Next: Defining a simple schema Up: Getting Started Previous: Starting the server   Contents

Subsections


Creating a database

The next step is to create a database to perform our tests.

This is very simple, you can try as follows:

% eyedbdbcreate foo
or more simply:
% dbcreate foo
If you use the default installation configuration, the following message will be displayed:
eyedbdbcreate: insufficient privileges: user 'guest': creating database 'foo'
This mean that all is ok: you - in fact user guest - was not authorized to create a database.

Two questions:

  1. why are you user guest?
  2. why the user guest does not have the privilege to create a database?

The answer to the first question is very simple: because the default configuration file iseyedbtop/eyedb-V2.7.3/archdir/etc/ArchConfig which includes the following lines:

#
# Default Authentication
#
 
user   = guest;
passwd = guest;
The answer to the second question is a little bit more complex.

If you display the user guest as follows:

% eyedbuserlist guest
name      : "guest"
sysaccess : idbNoSysAccessMode
the second line indicates that the user guest has no system access privileges:

The system access privileges control the following operations:

To create a database, one needs the first system access privilege.

So how to create a database? There are two ways:

  1. using an EYEDB superuser,
  2. creating a new user that has the appropriate system privilege and use it.

We are going to introduce these two ways.

Using an EYEDB superuser

We need first to know the name of an EYEDB superuser. During the installation process, three EYEDB users were created as shown by using the tool eyedbuserlist as follows:
% eyedbuserlist
name      : "eyedbroot"
sysaccess : idbSuperUserSysAccessMode
 
name      : "eyedb" [strict unix user]
sysaccess : idbSuperUserSysAccessMode

name      : "guest"
sysaccess : idbNoSysAccessMode
You can notice that eyedbroot and eyedb - mentionned as a strict unix user - have the super user system privilege which means that they can perform any operation on any database. The difference between these two users is beyond the scope of this manual. In this Section, we will use the eyedbroot user.

To create a database using the eyedbroot user, you need to do as follows:

% eyedbdbcreate foo -U eyedbroot -P
password authentication : {eyedbroot password}
You need to type the eyedbroot password that has been entered during the installation process (the embraces around the password means that these characters are not echoed on your terminal).


Creating a user with a system privilege

To create a user, you need to be a user that has the system privilege any user creation.

The simplest way is to use the EYEDB superuser eyedbroot.

Note that an EYEDB user is not a UNIX user. EYEDB provides its own user management. But an EYEDB user can be mapped on a UNIX user. Refer to the security section of the administation manual to get all information about that.

Let's assume you want to add the user bill, and try this:

% eyedbuseradd bill
Once again, an error message will be displayed:
eyedbuseradd: insufficient privileges: user 'guest': adding user
because you need to perform this operation under the user eyedbroot and you are still user guest.

So, you need to use the option -eyedbauth? as follows:

% eyedbuseradd -U eyedbroot -P {eyedbroot password} bill
bill password: {thekid}
retype bill password: {thekid}
If no error messages appear, the operation is sucessful.

Now, you need to add the any database creation system privilege to the user bill.

Try this:

% eyedbsysaccess
usage: eyedbsysaccess <username> ['+' combination of] dbcreate|adduser|deleteuser|setuserpasswd|admin|superuser|no
As shown above, the usage is displayed on your terminal.

For instance if you want to set the database creation and the user creation system privileges:

% eyedbsysaccess -U eyedbroot -P {eyedbroot password} bill dbcreate+adduser 
password authentication: {eyedbroot}


Creating a database using a specific user

Using an EYEDB user (for instance bill) that has the database creation system privilege, you can create a database as follows:
% eyedbdbcreate -U bill -P {bill password} foo
or as follows:
% eyedbdbcreate foo --user=bill --passwd=thekid
Nice, isn't it?

The problem is that you need to type your user and password each time you want to become the user bill because of the default configuration you are still the user guest, and this user cannot acces the database foo for read or write operations.

For instance, try:

% eyedboql -d foo
insufficient privileges: user 'guest': opening database 'foo'
Of course, it is possible to allow the user guest to perform read or write operations on the database foo, but it will be more clever to become the user bill.


Customizing your environment

It is very sumple to customize your environment: create a file, for instance EyeDBConfig in your home directory which contains the following lines:
include //etc/ArchConfig
 
user   = bill;
passwd = thekid;
Change the file access mode to 0600 for security reasons, as follows:
% chmod 0600 EyeDBConfig
then, set the environment variable EYEDBCONF to this file as follows:
% EYEDBCONF=~/EyeDBConfig; export EYEDBCONF # for Bourne Shells
% setenv EYEDBCONF ~/EyeDBConfig # for C Shells
To check, if this operation worked, try:
% eyedbgetenv version
2.6.6
% eyedbgetenv user
bill
if the good version number 2.7.3 and bill are displayed, the operation has succeeded.

Now you can try again:

% eyedboql -d foo
Welcome to eyedboql. Type `!help' to display the command list.
?
this is better. Type !quit or Control-D to exit from eyedboql.
next up previous contents
Next: Defining a simple schema Up: Getting Started Previous: Starting the server   Contents
EyeDB manual