unable to connect openMRS database

Hi Everyone, AWS server installed bahmni and openMRS.

       how to connect openMRS databse server 

I want to save patient our own Android App to openMRS database and patient will be populated both side (my Android App and bahmni EMR ) .

I am Unable to connect openMRS database every time giving me Exception

   com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

this is my simple jdbc code

Connection con = DriverManager.getConnection("jdbc:mysql://<IP>:<port>/openmrs", "root", "password");
			System.out.println("not connected");

For creating new patient, instead of trying to directly access DB, you should utilize the openmrs patient api. That will be the right approach.



See if Bahmniapps code can help you.

Please try using API, and if find any issues create a different post.

I want to getAllPatient record via userid or location . I there any API for getting AllPatientRecords.

bahmnicore extended api for running any sql query and get result is available. This might work for your case. Ex: https://product-qa08.mybahmni.org/openmrs/ws/rest/v1/bahmnicore/sql?location_uuid=baf7bd38-d225-11e4-9c67-080027b662ec&provider_uuid=c1c26908-3f10-11e4-adec-0800271c1b75&q=emrapi.sqlSearch.activePatients&v=full You can write your sql as per requirement. Like demo shows example of patients by location, patients by provider, active patients… etc…

emrapi.sqlSearch.activePatients is the openmrs global property with full sql as value. You can check it in openmrs-.admin->maintenance->Adv settings

thank you @swathivarkala