9

I am looking for a database which I can use to store data about certain stock over a number of years. There will probably be a few thousand records. I am writing an application in Java and Clojure which will pull out data from this local database when required to display the data.

I was wondering if anyone knew of a good database to work with for this purpose? I only have experience with MySQL running on the server side.

Which database would be easiest to work with in Clojure and Java for local storage?

Thanks,

Adam

adamjmarkham
  • 2,150
  • 2
  • 18
  • 26

4 Answers4

15

JDK 6 and greater comes bundled with Java DB which good enough for your use case.

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
  • 1
    Is Java DB the same as Apache Derby. I think it is but just wanted confirmation if there are any major differences? – adamjmarkham Jan 12 '12 at 23:23
  • 1
    @adamjmarkham "Sun said it will combine Apache Derby with its patches and call it "Java DB." The move adds yet another database to Sun's increasing support of open source applications." from http://www.internetnews.com/dev-news/article.php/3570696/Sun+Backs+Apache+Derby+With+Java+DB.htm – Aravind Yarram Jan 13 '12 at 00:31
4

For this kind of small-scale application it will almost certainly be easiest if you pick one of the many good embedded Java databases.

My personal top choices would probably be:

  • H2 - probably the best performance pure Java database overall, and if you believe their benchmarks then it is considerably faster than MySQL and indeed most other databases when run in a single machine environment.
  • Apache Derby - good all rounder, mature and well supported (Oracle have included a version branded as Java DB in recent JDKs)

After that, you should be able to use them pretty easily using the standard JDBC toolset, so not much different from MySQL.

If you're after a really nice DSL for interfacing with SQL databases with Clojure, you should definitely also take a look at Korma.

Community
  • 1
  • 1
mikera
  • 105,238
  • 25
  • 256
  • 415
  • 1
    Be aware that the "Apache Derby" mentioned here was absorbed into Java and renamed "Java DB"; they are just different names for the same thing. Apache Derby used to be a separate product. I researched differences and couldn't even find enough in terms of features or performance to justify adding a different jar file to the project, so I use Java DB. – arcy Jan 11 '12 at 02:11
  • hmmm correct me if I'm wrong but isn't Java DB in the JDK only? If you want to deploy to end users on the JRE (or to people running an older JDK), then you'll still need the extra jar file...... – mikera Jan 11 '12 at 02:19
3

I have used Apache Derby for a similar application (although written mostly in Java). They have been running it for almost four years now, and performed more than 60,000 transactions with it with no major problems. Only the occasional bug on my part.

Derby is the same database as JavaDB, however with Derby its easier to keep up on the releases as you can just include it as a dependency, rather than wait on the whim of when the next JDK rev is coming out.

Also, IIRC, JavaDB is only included with JDK, not the JRE.

BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
2

Depending on the nature of your data and application and your willingness and/or constraints in working with a new database modality, you might also want to consider one of the document-oriented databases, MongoDB or CouchDB. If your data and application are SQL oriented, use one of the databases suggested.

octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131