Solstice Enterprise Manager 4.1 Management Information Server (MIS) Guide Doc Set ContentsPreviousNextIndex


Chapter 7

Obtaining Data From the Database

This chapter provides information about querying the data in Solstice Enterprise Manager (Solstice EM) database.

This chapter describes the following topics:

7.1 Prerequisite Knowledge

To perform database queries, you will need to know the following:

7.2 Querying the Database

Advanced users can query the database for information from database tables. The two methods for obtaining data from the database are as follows:


Note – The DBTools.h++ support is discontinued in the Solstice EM 4.1 and subsequent releases. If you have DBTools.h++ and wish to use for accessing the databases through application, you can do so.

All access control restrictions and privileges apply to database queries, regardless of the querying method.

Using the em_sql command and standard SQL commands, you can query the Solstice EM database (emdb) directly.

If you are using your login name to start em_sql, make sure that the user name was created in Access Control, regardless of whether Access Control is on or off.

If Solstice EM is installed with Access Control off, you cannot run em_sql because the user was not created.


Caution – Changes to the database (adding, modifying, and deleting) should not be made using the em_sql command or SQL commands. Any changes made to the database in this manner may corrupt the contained management information. Changes would only be allowed in this manner if you were executing the file em_sql command as the Database Administrator UNIX user.

If you want to perform the same or a similar query often, you can type SQL commands in a file and redirect them to em_sql using the normal shell
input/output redirection methods. System prompts will not display.

 

To Query the Database

1. If you have installed the product in the default directory, log in to the database (local or remote) by typing the following command:

/opt/SUNWconn/bin/em_sql <login_name>/<password>@<host name>
If you omit the password, you will be prompted for it. If you omit the login name, em_sql will use your current login.


Note – If you installed the product in a different directory, substitute your partition name for /opt.

Your user login name determines the tables to which you have access. If you want to connect to a remote server, type the server name. If you omit the server name, the system assumes the database server is local.

2. Enter the SQL command and optional parameters to perform a database query.

Refer to any standard reference manual for SQL command syntax.

3. Type a semicolon and press the Return key to initiate the query.

The system queries the database and displays the result on your computer's monitor. The results can span several lines. Refer to the following code example.
CODE EXAMPLE 7-1   System Queries

# em_sql
Connecting to emdb as root...
em_sql> select agent_name[1,16], trans_addr[1,25]
2> from snmp_agents;
 
agent_name        trans_addr 
--------------------------------------- 
crow1             129.555.075.123:000161 
sherwood          129.555.075.456:000161 
orion             129.555.075.789:000161 
3 rows
em_sql>

4. To exit SQL, type quit or Control-D at the prompt.

7.3 Using Third-Party Software

Many third-party programs that simplify database query are compatible with the database used by Solstice EM. Third party programs are compatible if they are ODBC Level 1 compliant or are compliant with ANSI and ISO SQL92 standard at entry level.


Sun Microsystems, Inc.
Copyright information. All rights reserved.
Doc Set  |   Contents   |   Previous   |   Next   |   Index