I have written a java program that does some logic check which involves a database call. 
I was able to call a simple cpp program from java using JNI stackoverflow question. 
How can I do the opposite, i.e Is there a way to call java (with database) from a cpp program? 
I have PostgreSQL database. Any direction would be a great starting point for me. 
Thank you for your time. :)
Edit
Seems like a similar question has a very nice answer here link