# Running a device server without SQL database

Intended audience: administrators, developers

## Device server using file as database

For device servers not able to access the Tango database (most of the time due to network route or security reason), it is possible to start them using file instead of a real database. This is done via the device server

-file=<file name>

command line option. In this case,

- Getting, setting and deleting class properties

- Getting, setting and deleting device properties

- Getting, setting and deleting class attribute properties

- Getting, setting and deleting device attribute properties

are handled using the specified file instead of the Tango database. The file is an ASCII file and follows a well-defined syntax with predefined keywords. The simplest way to generate the file for a specific device server is to use the Jive application. See [Jive] to get Jive documentation. The Tango database is not only used to store device configuration parameters, it is also used to store device network access parameter (the CORBA IOR). To allow an application to connect to a device hosted by a device server using file instead of database, you need to start it on a pre-defined port, and you must use one of the underlying ORB option called endPoint like

myserver myinstance_name -file=/tmp/MyServerFile -ORBendPoint giop:tcp::<port number>

to start your device server. The device name passed to the client application must also be modified in order to refect the non-database usage. See device naming to learn about Tango device name syntax. Nevertheless, using this Tango feature prevents some other features to be used :

- No check that the same device server is running twice.

- No device or attribute alias name.

- In case of several device servers running on the same host, the user must manually manage a list of already used network port.

## Device server without database

In some very specific cases (Running a device server within a lab during hardware development…), it could be very useful to have a device server able to run even if there is no database in the control system. Obviously, running a Tango device server without a database means loosing Tango features. The lost features are :

- No check that the same device server is running twice.

- No device configuration via properties.

- No event generated by the server.

- No memorized attributes

- No device attribute configuration via the database.

- No check that the same device name is used twice within the same control system.

- In case of several device servers running on the same host, the user must manually manage a list of already used network port.

To run a device server without a database, the -nodb command line option must be used. One problem when running a device server without the database is to pass device name(s) to the device server. Within Tango, it is possible to define these device names at two different levels :

1. At the command line with the -dlist option: In case of device server with several device pattern implementation, the device name list given at command line is only for the last device pattern created in the class_factory() method. In the device name list, the device name separator is the comma character.

2. At the device pattern implementation level: In the class inherited from the Tango::DeviceClass class via the re-definition of a well defined method called device_name_factory()

If none of these two possibilities is used, the tango core classes defined one default device name for each device pattern implementation. This default device name is NoName. Device definition at the command line has the highest priority.

### Example of device server started without database usage

Without database, you need to start a Tango device server on a pre-defined port, and you must use one of the underlying ORB option called endPoint like

myserver myinstance_name -ORBendPoint giop:tcp::<port number> -nodb -dlist a/b/c

The following is two examples of starting a device server not using the database when the device_name_factory() method is not re-defined.

- StepperMotor et -nodb -dlist id11/motor/1,id11/motor/2
  This command line starts the device server with two devices named id11/motor/1 and id11/motor/2
- StepperMotor et -nodb
  This command line starts a device server with one device named NoName

When the device_name_factory() method is re-defined within the StepperMotorClass class.

    1  void StepperMotorClass::device_name_factory(vector<string> &list)
    2  {
    3      list.push_back("sr/cav-tuner/1");
    4      list.push_back("sr/cav-tuner/2");
    5  }

- StepperMotor et -nodb
  This commands starts a device server with two devices named sr/cav-tuner/1 and sr/cav-tuner/2.
- StepperMotor et -nodb -dlist id12/motor/1
  Starts a device server with only one device named id12/motor/1

### Connecting client to device within a device server started without database

In this case, the host and port on which the device server is running are part of the device name. If the device name is a/b/c, the host is mycomputer and the port 1234, the device name to be used by client is

mycomputer:1234/a/b/c#dbase=no

Some clients like atkpanel require tango:// prefix:

tango://mycomputer:1234/a/b/c#dbase=no

See device naming for all details about Tango object naming.