简体   繁体   中英

MySQL : Connect locally using Java

I have a MySQL database and a java application using it thru JDBC. I want to distribute the application. I copied the DB to my application folder. I also have myconnectionj jar file included in the project.

How to create the url/connectionString to connect to the database along with the application instead of using server ? I want to connect like we do for Access files. We can distribute it with the application easily and use it. How to achieve the same with MySQL DB without using server.

I don't know if MySQL can provide that flexibility. But exist other Databases which enable to you store the data in a file and port it across to clients. You can ckeck the following:

  1. Derby DB
  2. HSQL DB
  3. SQL Lite

I'm not sure if there is a mysql-wrapper for such tests. AFAIK you need a running server.

If you need portability you should check file-databases like: H2 , HyperSQL or SQLLite .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM