i am try to connect to a database as seen here https://pastebin.com/EqEZhk5g .But i constantly get this error https://pastebin.com/5z65hxrp. This is my pom.xml https://pastebin.com/PrB5xHES. And the dataset is demo.1.9.0.sql.Any suggetions on solving the above?
Though this is not what you are asking, what are you trying to accomplish? What is the use case?
i want to carrry out different tests on how different services work
Did you get a chance to look at the tests here? https://github.com/openmrs/openmrs-core/tree/master/api/src/test/java/org/openmrs/api
let me look through it.thanks for the link because it contains the services that i want .
@dkayiwa The link you droped me is good,but also i want t o make sure that i can get data from the database and display it on my console as i follow the steps about the openmrs api on this link https://wiki.openmrs.org/display/docs/How+To+Use+the+OpenMRS+API At first ,i followed the steps and all was working fine using the below code,i added some information and also dispalyed it following the steps on the above link,but a day later,it brings me an error as on https://pastebin.com/LPDD4NH1 .I have googled about liquidbase and changesets and it looks like i might have changed some thing,will be grateful for any idea about the error .
package com.test;
import java.io.File;
import java.util.List; import java.util.Properties;
import org.openmrs.Patient; import org.openmrs.api.context.Context; import org.openmrs.module.ModuleMustStartException; import org.openmrs.util.DatabaseUpdateException; import org.openmrs.util.InputRequiredException; import org.openmrs.util.OpenmrsUtil;
public class Test {
public static void main(String [] args) throws ModuleMustStartException, DatabaseUpdateException, InputRequiredException{
File propsFile = new File(OpenmrsUtil.getApplicationDataDirectory(), "openmrs-runtime.properties");
Properties props = new Properties();
OpenmrsUtil.loadProperties(props, propsFile);
Context.startup("jdbc:mysql://localhost:3306/openmrs?autoReconnect=true", "root", "onlylord", props);
try {
Context.openSession();
Context.authenticate("admin", "Admin123");
List<Patient> patients = Context.getPatientService().getPatients("John");
for (Patient patient : patients) {
System.out.println("Found patient with name " + patient.getPersonName() + " and uuid: " + patient.getUuid());
}
}
finally {
Context.closeSession();
}
}
}
The database you are connecting to was created by a version of openmrs different from the one of the API that your code is using.
@dkayiwa Still trying on this one,i have used a couple of different api and databases but still getting different errors for example when i use openmrs api version 1.8.0 and database 1.8.0,i get https://pastebin.com/RqHSKgpx I have read on a thread about such kind of error and it suggested using mvn clean install which i did and the error persists!
@dkayiwa Heilo,which versions of openmrs api and database could you recomend me for this,have tried a couple of them but all giving me diffeent erros
Though all versions should work, i would recommend using the latest stable release.
okie then thanks much