Reputation: 11
I'm working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate to this system and embed a database in my application? are there real performance gains? Thanks a lot
Upvotes: 1
Views: 4341
Reputation: 16359
Embedding Derby in a Java desktop application is straightforward. You simply add the Derby jar to your application, decide where you want to store your data on disk, and write standard SQL and JDBC calls to invoke Derby operations. Well-written Derby applications can deliver extremely high performance but you must pay attention to your schema and transaction design. Derby has good tools for analyzing and addressing performance problems.
Upvotes: 1
Reputation: 36095
I don't think you will get notable performance gains on any standard desktop - as long as your application isn't doing nothing else but torturing the file system with reads and writes :) At the end, performance mainly depends on your code.
If you consider switching to SQLite, you may want to have a look at SQLJet, a pure Java implementation of SQLite. I haven't used it myself, but I think deploying it should be similar to Derby: all you need is add some Jars to your application and you are settled. I would try to avoid using external SQLite (or any other dependency on an external application) as it will considerable complicate the setup of your application.
Upvotes: 2
Reputation: 61518
I don't think you will get a performance just by changing the data store to SQLite. You should migrate a FS-based store to a relational (SQL) database store if.
Those are some of the gains you get by switching to SQLite.
You can gets performance gains from SQLite if you also properly utilizes one or more of the above properties of a relational store that you don't have using a file-based system.
Upvotes: 7