2

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:

  • Simply launch the executable to startup mysqld as part of the application's startup script
  • Write/Use a JNI wrapper around libmysqld to startup the server at application start and stop it at application stop (this would be the preferred method)

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?

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.