Reputation: 398
It used to be that you could use Connector/MXJ to embed a MySQL Database in to a Java Application, however the Connector/MXJ project has been EOL'd by Oracle (thanks Larry) so I am looking for the best way to accomplish my goal.
Our application ships with an embedded Tomcat and JRE and we would like to embed the MySQL database as well (don't ask if we can use some other database engine - it has to be MySQL). I can't find any good documentation or answers on the best way to do this so here are the thoughts that I have come up with:
For the second (preferred) option, I don't think writing a JNI wrapper around the libmysqld calls would be too difficult, however I am wondering if that would even work since libmysqld only provides access to code running in the same process (no named pipes or tcp access). Would a process kicked off within a running java app allow the parent application to access the database?
Upvotes: 2
Views: 1647
Reputation: 3127
Perhaps try this. It's for MariaDB, which may be ok, or it might even work with MySQL since they should be largely compatible.
https://github.com/vorburger/MariaDB4j
Upvotes: 1