问题
Which database is suitable for swing desktop application
from the followings :?
- SQLite
- Apache Derby
- HyperSQL DB
I want to store my data locally instead of using web service and store for temporary from the above which is lighten local database ?
回答1:
To add to the embedded SQL answer, you can also run the noSQL Neo4J in memory without the need for disk access.
If I remember your previous question, you want to actually ship the data inside the jar, correct? Then you need to ship the data as files and load it into the database each and every time you start the application. That's a massive question and you really need to start reading up on one of the embedded databases mentioned in these answers. You need to look at your data and look at the options then decide which database to use.
Put simply, this will not work with mySQL, you need to use an embedded database. Easiest way would be to
- Create and populate it any way you like
- Export the data
- Store the export file in your jar file.
- Write code in your application that a) starts an embedded database on startup b) loads the data from the jar file into it
回答2:
Your created jar can't contain database at all. Solution is to use some kind of embedded database. Have a look at some of these:
- SQLite
- Apache Derby
- HyperSQL DB
回答3:
SQLite is a light weight database but it contains some drawbacks like it is not password protected or encrypted, and you cannot alter the columns in your table.
H2 is also a light weight database which can either be embedded or used on a network. It provides password protection, encryption and also easy to alter the table structure. It is also faster compared to sqlite.
Apache derby - I have no idea.
I prefer H2.
来源:https://stackoverflow.com/questions/19245143/suitable-database-for-swing-application-which-does-not-need-server-dependancy