- To connect to your database, you have to create a handle: this handle actually links the interface classes with corresponding implementation classes mapped to your DBMS. This handle is implemented by the DATABASE_APPL class:
database_appl: DATABASE_APPL [ODBC]
...
create database_appl.login (a_name, a_psswd)
database_appl.set_base
Note: Calling set_base links the EiffelStore interface to this specific handle.
Tip: You can manage handles to many databases: as an instance of DATABASE_APPL stands for a specific database handle, you only have to create one instance of DATABASE_APPL for every DBMS handle you wish to create. Do not forget to call set_base to activate appropriate handle.
Note: The generic parameter of DATABASE_APPL specifies the actual DBMS used.
- Once your handle is created, you have to create a session manager which will allow you to manage your database, specifically to establish connection, disconnect and also handle errors. The class DB_CONTROL enables your application to plainly control the functioning and status of your database and to request any information about it.
session_control: DB_CONTROL
...
create session_control.make
session_control.connect
Note: Take a look at the database control part to see how to use DB_CONTROL capabilities.
See Also
Database control and error handling
Implementation