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:![](https://pitstop.manageengine.com/galleryDocuments/edbsnabf4d9d4b9c5350210dc0aa820b01c02530bc39fd790dae010793759ea34bfd7e440a98c6d2b1a1920c974ac4e74d374?inline=true)
However, if you try to write/update, permission will be denied.
Example:![](https://pitstop.manageengine.com/galleryDocuments/edbsnd6744768e599562fba38419049539afb032aaf067df17bcdfc0de97fccbab3e0b6d76c03330c67e604b4dc97a3c8ca58?inline=true)
For Linux:
AppManagerHome/working/pgsql/bin$ export PGPASSWORD=apmrouser
AppManagerHome/working/pgsql/bin$ ./psql -p 15432 -U rouser -h localhost -d amdb