How to use embedded MySQL in Java

This document mainly introduces the use of embedded MySQL in Java. For some application projects, it is necessary to provide the installed version of MySQL and Oracle. But sometimes if it is a small tool, it can install or transplant small software with strong portability. It may be more troublesome to install the database.

In fact, MySQL is also embedded and does not need to be installed. In the process of use, it will automatically create a database and start or close it through code. Some code snippets are provided below, and the specific download address will be provided.

This is the core code class, which implements the start and stop of MySQL and the start state of the database.

The following is to start the demo,

MysqL_ general. Properties configuration example of general machine

MysqL_ medium. Configuration example of medium-sized machine in properties

MysqL_ large. Properties configuration example of high configuration machine

Specific parameters can be defined according to different requirements. For example, ports can be defined freely.

Mysql-connector-mxj-gpl-6-0-11-db-files jar,mysql-connector-mxj-gpl-6-0-11. jar

The code is on GIT and the address is: https://git.oschina.net/eliyanfei/api_tools.git

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>