Yes, obviously you must first connect to database to be able to unlock anything ;). Right after the connection your application (being java or c++ or Forms or VisualBasic or cobol or...., it is irrelevant which) must isue the following call:

"SET ROLE app_role IDENTIFIED BY top_secret;"

That's it, anything is now unlocked to your user.