connect openmrs to oracle database

I will like to install openmrs reference application 2.8.1 using the openmrs sdk Could it be connected to an oracle database? If yes, which option should I choose when asked “which database would you like to use”

hello @ngabo currently the openmrs sdk supports mysql database, though there are under the hood plans to make openmrs and the sdk support other db systems forexample postgres sql

Thank you cliff for this openmrs ongoing plan is there any adjustment will i make on openmrs to work with existing oracle database ?

@ngabo , Though we have not tested the application specifically on Oracle db but we have recently added support for PostgreSQL for platform and Ref. App. It would be great if you try setting up OpenMRS via the steps listed here https://wiki.openmrs.org/display/docs/OpenMRS+Setup+On+PostgreSQL and report your findings. Just make sure when setting up OpenMRS, you specify the oracle jdbc driver and db url for oracle db server that you are running. :slightly_smiling_face:

1 Like

Thank you Aman looks promising will revert any outcome on this

Hello Aman

I want to connect openmrs to oracle database i got an error while connecting openmrs to oracle database 12c

i have created oracle db named orcl then provide database connection jdbc, set oracle driver path
am using windows 10 OS

will appreciate any help on this.

Well, I really like the zeal! that is a clear indication that openmrs apparently is not supporting oracle database 12c though that doesn’t mean it cannot support. Apparently no one can give you an exact answer since its not configured to do so. Is there something we are missing out by using MySQl and PostgreSQL?

1 Like

We don’t bundle the Oracle JDBC driver with OpenMRS, so you’d need to make sure that it’s available on the classpath for your OpenMRS install. The easiest way to do this is to customise your local copy of openmrs-core to include the Oracle JDBC driver in the main POM.xml file and then in the POM.xml file for the web sub-module. You could then build a WAR from that (mvn clean package) and copy the WAR file over the version you are trying to run.

You’d probably also need to update the openmrs-runtime.properties file to have a entry like hibernate.dialect=org.hibernate.dialect.Oracle12cDialect. @aman Do we need to do something similar for PostgreSQL? I didn’t see a step like that in your instructions.

2 Likes

Now that I give a close look here https://github.com/openmrs/openmrs-core/blob/72bc37119728a3a76cfb0cffaeed51f2d174d636/web/src/main/java/org/openmrs/web/filter/initialization/InitializationFilter.java#L1533 , I see that setting up hibernate dialect setting for PostgreSQL is automated but it is not the case for Oracle DB. Clearly, to automate this will require some tweaking in Initialization filter class for Oracle DB, not just only for dialect but also may be for creating users , setting up db as well.

@ngabo , thanks for trying but now I think there won’t be a direct way for setting up Orcale directly with OpenMRS. On the other hand , could there be any possibility of switching to MySQL or PostgreSQL ?

Actually, I’d hope we can dispense with this kind of thing altogether. Hibernate has, for years, been able to auto-detect the Dialect. See the docs on this. I’d think what we actually want to do is remove any reference to a specific Hibernate dialect unless we explicitly need to, in which case we should use the org.hibernate.dialect.resolver.DialectResolver SPI.

3 Likes

@ibacher , That should be the optimal behavior. Let me see into it. Btw I just remembered we had a discussion on similar topic months back Patient Management in PostgreSQL

1 Like

Well, at least I’m semi-consistent! Thanks for looking into this @aman!