Connecting to Applications Manager's bundled database

Connecting to Applications Manager's bundled database

Before you connect to Applications Manager's back-end database, it is important that you take a backup of the Applications Manager directory so that you don't make any changes/accidentally modify the database.

Identify which database Applications Manager is using. Navigate to <Applications Manager Home>\conf\ directory and open AMServer.properties file. Check the value of am.dbserver.type variable. If it is MySQL, you will migrate to a different database as Applications Manager does not support MySQL anymore (from v16240). If it is PostgreSQL, follow the steps given below:

PostgreSQL database

Applications Manager Standalone

Connect to the PostgreSQL database through the following commands one by one from the server in which Applications Manager has been installed:

Windows

For Applications Manager v16670 & above:
1. Open command terminal, then navigate to the <Applications Manager Home>\bin directory and execute the following command: 
DBConfiguration.bat -u dbuser
2. Then navigate to <Applications Manager Home>\working\pgsql\bin directory and execute the following command:
psql -p 15432 -U dbuser -h localhost -d amdb
For Applications Manager v16660 & below: 
1. Open command prompt and navigate to the following directory:
<Applications Manager Home>\working\pgsql\bin
2. Execute the following commands one by one:
set PGPASSWORD=appmanager

psql -p 15432 -U postgres -h localhost  -d amdb
Note: In the above commands, "amdb" is the name of the database of Applications Manager. 
15432 is the port on which Applications Manager's PGSQL database runs (you can get this value from <Applications Manager Home>\conf\AMServer.properties file, by checking the value of am.db.port variable ).
Sample screenshot:

Linux

For Applications Manager v16670 & above:
1. Open command terminal, then navigate to the <Applications Manager Home>\bin directory and execute the following command: 
. ./DBConfiguration.sh -u dbuser
2. Then navigate to <Applications Manager Home>\working\pgsql\bin directory and execute the following command:
./psql -p 15432 -U dbuser -h localhost -d amdb
For Applications Manager v16660 & below:
1. Open terminal and navigate to the following directory:
<AppManagerHome>/working/pgsql/bin
2. Execute the following commands one by one.
export PGPASSWORD=appmanager

./psql -p 15432 -U postgres -h localhost  -d amdb

Note: In the above commands, "amdb" is the name of the database of Applications Manager. 
15432 is the port on which Applications Manager's PGSQL database runs (you can get this value from <Applications Manager Home>\conf\AMServer.properties file, by checking the value of am.db.port variable ).
Sample screenshot:


APM Plugin (Applications Manager Plugin installed on OpManager)

1. Open command prompt/terminal and navigate to <OpManager home>/pgsql/bin directory.
2. Execute the following command:
Windows:
psql -p 13306 -U postgres -h localhost -d amdb
Linux:
./psql -p 13306 -U postgres -h localhost -d amdb

Note: Follow the below steps to connect to the Applications Manager plugin DB if OpManager's PostgreSQL DB has been upgraded to version 12.5.xx :
1. Connect to the OpManager DB using the below command: 
 psql.exe -U dbuser -h 127.0.0.1 -p 13306 <OpManager DB Name>
2. Then enter the password for user dbuser.

Note: The database password for the user dbuser is uniquely encrypted for each installation. To obtain the database password for dbuser the following files from the OpManager installation will be required.
i) <OpManager home>\conf\database_params.conf (value of password  for dbuser from this file will be used)
ii) <OpManager home>\conf\customer-config.xml (value of CryptTag from this file will be used)
These files must be shared with a support technician, who will decrypt the dbuser password for you to connect to the Applications Manager plugin database.

3. Once connection to the database is successful, to list the databases inside the OpManager DB, enter the following command: 
\l 
4. After checking Applications Manager's plugin database name, enter the following command: 
\c <DB name>
  Example: \c amdb
5. Now it will connect to the Applications Manager plugin database.

MySQL Database (Now deprecated)

Windows:
1. Open command prompt. Navigate to the following directory:
<AppManagerHome>\working\mysql\bin
2. Execute the following command:
mysql.exe -h localhost -u root -P 13326 -pappmanager -D AMDB -A
Note: In the above commands, AMDB is the name of the database of Applications Manager. 
13326 is the port on which Applications Manager's MySQL database runs (you can get this value from <Applications Manager Home>\conf\AMServer.properties file, by checking the value of am.db.port variable ).

Linux:
1. Open terminal. Navigate to the following directory:
<AppManagerHome>/working/mysql/bin
2. Execute the following command:
mysql -h localhost -u root -pappmanager --socket=./../mysql.sock -D AMDB -A
Note: In the above commands, AMDB is the name of the database of Applications Manager. 
 Sample screenshot:


Troubleshooting PostgreSQL Connection refused error

In the Applications Manager server, please open the WordPad with admin rights and open the hosts file present under C:\Windows\system32\drivers\etc\ directory (or under /etc directory in case of Linux), then uncomment by removing the hash (#) symbol as shown below and save it.
 
#     127.0.0.1       localhost
             to
     127.0.0.1       localhost

In the same location if you have IPV6 entry in hosts file, comment that and save the file.

# ::1             localhost

In the same location if you have IPV6 entry in hosts file, comment that and save the file.

#::1            localhost6.localdomain6 localhost6

                  New to ADSelfService Plus?

                    • Related Articles

                    • Maintenance of Applications Manager backend database

                      Note: Please take complete database backup without fail prior to these steps. I. Applications Manager with PostgreSQL Database. Shutdown all Applications Manager related process as follows: For windows: Open services.msc --> stop ManageEngine ...
                    • Migrating the JRE bundled in Applications Manager

                      JRE Upgrade Document for Applications Manager This document helps the end-user in upgrading to the latest version of Java used in Applications Manager. The steps for Java upgrade in both Windows (Service and Non-Service mode) and Linux installations ...
                    • Installing Applications Manager in AWS

                      Applications Manager can be installed in EC2 instances in both Windows and Linux platforms.  Applications Manager comes with bundled PostgreSQL. Installing Applications Manager in EC2 for Windows Go to EC2 console and launch an "Windows" instance ...
                    • Integrating Applications Manager DB with Grafana

                      Grafana is an open-source data visualization tool that collects data across multiple software platforms and retrieves them altogether in a single dashboard. It provides advanced analytics by connecting to various data sources in different platforms, ...
                    • Error message while performing database backup of Applications Manager

                      While performing a database backup operation of Applications Manager build with Pgsql backend, you may encounter the following error, especially when your database size has grown bigger with a large number of tables.   pg_dump: WARNING: out of shared ...