7. Managing Databases Associated with JBoss ON
There are several basic tasks that can be done to manage the Oracle or PostgreSQL databases that are used by the JBoss ON server.
7.1. Running SQL Commands from JBoss ON
SQL commands can be run through the JBoss ON web UI on any database that the JBoss ON server is using for its data.
Note
The database management page is not accessible through the normal JBoss ON GUI. Administrators must manually navigate to the admin area of the JBoss ON UI.
Note
Whatever JBoss ON user you are logged in as must have adequate user rights on the database to execute the SQL commands.
- Open the administrative page, with the location
admin/test/sql.jsp
. For example:http://server.example.com:7080/admin/test/sql.jsp
- Enter the SQL commands, as appropriate for the JBoss ON Oracle or PostgreSQL database instance. If there are multiple commands, make sure the Continue if statements fail? checkbox is selected. That way, even if one command fails, the other commands will be submitted. Otherwise, the series will be terminated at the first failure.
- Click thebutton.
7.2. Changing Database Passwords
The JBoss ON server connects to its database instance as a database user. It does this automatically, using the credentials given in its
rhq-server.properties
file. The database password is encoded automatically by the installer before it is stored in the rhq-server.properties
file, to provide some extra protection against unauthorized access to the database password.
It's possible that the password for that database user account is changed. This change always occurs at the database, not in JBoss ON, so the password in the
rhq-server.properties
file has to be manually encoded and updated for JBoss ON to continue to function.
- Change the password for the JBoss ON user (
rhqadmin
by default) in the database. - Use the
generate-db-password.sh
script to encode the password.serverRoot/bin/generate-db-password.sh mypassword Encoded password:
1d31b70b3650168f79edee9e04977e34
JBoss ON stores its database password in an encoded form in therhq-server-properties
file. Therefore, the new database has to be properly encoded before it's added to therhq-server-properties
file so that the server reads it correctly. - Edit the
rhq.server.database.password
value in therhq-server.properties
file so that it has the new encoded password value.vim serverRoot/bin/rhq-server.properties rhq.server.database.password=
1d31b70b3650168f79edee9e04977e34
7.3. Editing the JBoss ON Server's Database Configuration
The JBoss ON server is always connected to a backend database to store most of its data, such as agents and resources in its inventory and plug-in configuration. The parameters for connecting with the database are defined in
rhq-server.properties
.
Example 7. Default Configuration for a PostgreSQL Database
# Database rhq.server.database.connection-url=jdbc:postgresql://127.0.0.1:5432/rhq rhq.server.database.driver-class=org.postgresql.Driver rhq.server.database.xa-datasource-class=org.postgresql.xa.PGXADataSource rhq.server.database.user-name=rhqadmin rhq.server.database.password=1eeb2f255e832171df8592078de921bc rhq.server.database.type-mapping=PostgreSQL rhq.server.database.server-name=127.0.0.1 rhq.server.database.port=5432 rhq.server.database.db-name=rhq hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Parameter | Description |
---|---|
rhq.server.database.type-mapping | Gives the type or vendor of the database that is used by the JBoss ON server. This is either PostgreSQL or Oracle. |
rhq.server.database.connection-url | The JDBC URL that the JBoss ON server uses when connecting to the database. An example is jdbc:postgresql://localhost:5432/rhq or jdbc:oracle:oci:@localhost:1521:orcl. |
rhq.server.database.driver-class | The fully qualified class name of the JDBC driver that the JBoss ON server uses to communicate with the database. An example is oracle.jdbc.driver.OracleDriver. |
rhq.server.database.xa-datasource-class | The fully qualified class name of the JDBC driver that the JBoss ON server uses to communicate with the database. Examples of this are org.postgresql.xa.PGXADataSource or oracle.jdbc.xa.client.OracleXADatasource. |
rhq.server.database.user-name | The name of the user that the JBoss ON server uses when logging into the database |
rhq.server.database.password | The password of the database user that is used by the JBoss ON server when logging into the database. This password is stored in a hash in the rhq-server.properties file. When the password is changed in the database, then the password must be manually hashed and copied into the rhq-server.properties file. This is described in Section 7.2, “Changing Database Passwords”. |
rhq.server.database.server-name | The server name where the database is found. This must match the server in the connection URL. This is currently only used when connecting to PostgreSQL. |
rhq.server.database.port | The port on which the database is listening. This must match the port in the connection URL. This is currently only used when connecting to PostgreSQL. |
rhq.server.database.db-name | The name of the database. This must match the name found in the connection URL. This is currently only used when connecting to PostgreSQL. |
rhq.server.quartz.driverDelegateClass | The Quartz driver used for connections between the server and the database. The value of this is set by the installer and depends on the type of database used to store the JBoss ON information. For PostgreSQL, this is org.quartz.impl.jdbcjobstore.PostgreSQLDelegate , and for Oracle, this is org.quartz.impl.jdbcjobstore.oracle.OracleDelegate . |