To connect to the database, you will need the following information:
Port number: The port in which the Applications Manager database runs. (You can get this from am.db.port value in <Applications Manager Home>\conf\AMServer.properties file). The default value is 15432.
Username: The username of the user that wants to connect to the DB. Since we are going to connect a read-only user, the username will be rouser.
Password: The password for this specific username. For read-only user, you can use apmrouser.
For Windows:
AppManagerHome\working\pgsql\bin> set PGPASSWORD=apmrouser
AppManagerHome\working\pgsql\bin>psql -p 15432 -U rouser -h localhost -d amdb
amdb=> indiactes that you are connected to the database and now any read-related queries can be executed.
Example:
However, if you try to write/update, permission will be denied.
Example:
For Linux:
AppManagerHome/working/pgsql/bin$ export PGPASSWORD=apmrouser
AppManagerHome/working/pgsql/bin$ ./psql -p 15432 -U rouser -h localhost -d amdb