In looking at the Jasper Reports module, I see that it needs a jdbc
connection to pass to the Jasper report generator. The way it is coded, it
accepts only MySQL because that is the only driver name that it knows.
I'm pretty sure BIRT also needs a DB connection, but I think the BIRT
module has avoided the need for BIRT to access the OpenMRS DB by writing an
intermediate output file to a known location for the BIRT report generator to
use with a text driver. This is slower than accessing the DB directly (but may
have other advantages).
It seems reasonable that there would be other modules that need a jdbc
connection to the DB, MIRTH and deduplicate jump into mind immediately. They
should be provided with the means of getting/making a connection to any
supported OpenMRS database. I don't think we want to share our primary
connection; for example, we might want to run a MIRTH connection at a lower
priority than our own.
We are already doing this process several times in trunk (in the Wizard, in
the non-web startup routine, in the DB updater (where it's used by Liquibase),
in the web startup routine). The most complete process is found in
DatabaseUtil:loadDatabaseDriver to load the appropriate driver, either by
reading an optional runtime property or by finding a known DB in the DB URL
runtime property; but this is not exposed through the Admin Service. The DB
URL property seems to be set once it is found (messing around inside the user's
file system). However, we use the connection information available through
Hibernate properties to get the driver class and dialect.
I would suggest that we create a sort of factory class (make an instance
available through the Admin Service?) that uses the properties file and the
logic of loadDatabaseDriver to get the driver information and has methods to
get a jdbc parameter (driver class, DBURL, username, password, dialect?) or a
new connection. We should use it consistently in trunk code. Then we should
check the modules to make sure that they are using this rather than supporting
only MySQL.
Thoughts?
_________________________________________
To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to
[email protected] with "SIGNOFF openmrs-devel-l" in the body (not
the subject) of your e-mail.
[mailto:[email protected]?body=SIGNOFF%20openmrs-devel-l]