[jruby-user] embedded db for Jruby

46 views
Skip to first unread message

Charles Monteiro

unread,
May 17, 2013, 1:28:11 PM5/17/13
to Jruby Users List List
hi all,

I'm looking for an embedded database that I would use for jrubyfx desktop app. Ideally it would be the same database that I would use for a common repository but it probably wont' be since I want to use Heroku add ons or other PaaS. I guess push come to shove I can do Amazon.

I went back to the Jruby book and that basically was about using rdms via ActiveRecord which is ok but not ideal. If I went down that path I know I could use Derby which is embeddable and can be run also in network mode. Packaging Derby with the app is painless. There's of course sqllite and given that every OS out there basically supports it including iOS and Android it might make a great choice but again ActiveRecord. Yes, there's a mobile component as well to my effort so that context is a consideration.

Coming from a strong Object Db background an object db with tranparent semantics would be great but I can't seem to find one. I don't want a in-memory db strategy. The datasets locally will be large enough that you would not want to load the entire db into memory.

I have looked at TouchDB which has CouchDB and Couchbase Server as network counterparts but that seems to be a bit up in the air and not sure how much that buys me. Frankly, ActiveRecord looks cleaner.

As I write this i bump into db4o by Versant which had a Smalltalk OODMS, looks great, its Java based so hooking it up to JRuby should be do-able. but its GPL which is a problem because the project is a low priced app for sale and making the licensing costs will be well probably impossible for a few years if lucky.

Anyhow I'm getting stuck looking for the perfect fit, I figured some here may have gone done the same path. Of course JRuby integration is key. Any feedback is appreciated.

thanks




Charles Monteiro
jr...@smallruby.com




---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Steven McCraw

unread,
May 17, 2013, 1:44:05 PM5/17/13
to us...@jruby.codehaus.org
For relational, Derby is nice because it actually ships with java 7
out of the box now. Lately I've been using Titan with Cassandra
embedded on the back end (accessed through the pacer gem), and it has
been awesome stuff so far. I'm not qualified to weigh the pros and
cons of graph vs relational across the board, but coming from a
relational background, I'm really happy with graph at the moment. Hope
this helps!

Mark

Sent from my mobile device. Apologies for brevity.

Eric West

unread,
May 17, 2013, 2:33:15 PM5/17/13
to us...@jruby.codehaus.org
I've recently come across https://github.com/Softmotions/ejdb which looks like it could be worth exploring, it's based on TokyoCabinet. You'd probably want the java binding and not the ruby binding. I've been thinking about using https://github.com/andreasronge/neo4j , which shouldnt be hard to embed . I've not yet tried either.

Another possibility is trying to get http://open-dolphin.org/dolphin_website/Home.html working with jrubyfx. Here the idea is that you have a desktop app with views written in javafx on the client and the controllers, database, etc running in a seperate process or on a server. 

Anyways, just thought I'd toss a few more possibilities at you.
Eric

Thomas E Enebo

unread,
May 17, 2013, 2:36:15 PM5/17/13
to us...@jruby.codehaus.org
I don't know how suited neo4j is for embedded development but it is a graph database.  So perhaps it might be closer to being able to model OODBMS-like constructs an RDBMS.

-Tom
--
blog: http://blog.enebo.com       twitter: tom_enebo
mail: tom....@gmail.com

Christian MICHON

unread,
May 17, 2013, 2:44:05 PM5/17/13
to us...@jruby.codehaus.org
I would suggest H2 database in embedded mode (google for h2database,
no white space) if you're looking for a SQL database.

We've used it with many jruby based applications as it is a native
java library, and it's really more powerful and complient than sqlite
(where you'd need os dependent bindings).

Lastly, I would suggest to use sequel as ORM instead of activerecord.

If you're looking for NoSQL database, I would suggest Neo4j (graph),
OrientDB (graph+document) or Akiban Persistit (key-value store): again
all 3 are pure java libs.

Good luck.
--
Christian

Charles Monteiro

unread,
May 17, 2013, 3:03:17 PM5/17/13
to us...@jruby.codehaus.org
thanks, they claim its highly suitable , and yes graphs are better than document dbs in modeling natural object relations , the querying is not natural looking at all but overall I can't do their license

Charles Monteiro


Charles Monteiro

unread,
May 17, 2013, 3:13:30 PM5/17/13
to us...@jruby.codehaus.org
I actually do use Sequel for a separate project and its a nice framework.

I had seen OrientDB before I'll give it further thought, a nice combo of graph and document , however I did not like the sql querying semantics

Charles Monteiro
jr...@smallruby.com

Steven McCraw

unread,
May 17, 2013, 9:17:13 PM5/17/13
to us...@jruby.codehaus.org
Neo4j looks great, but I couldn't use it for the same reason (licensing). Titan/Cassandra has filled that gap nicely for me, though, and pacer has proved to be a great framework (even if a tad under documented). They both seem to have smart, supportive people behind them. 


Sent from my mobile device. Apologies for brevity.

Charles Monteiro

unread,
May 17, 2013, 2:02:39 PM5/17/13
to us...@jruby.codehaus.org
I briefly looked at Titan and then at Neo4j whose license is to onerous to risk. I'll check it out again, graph dbs are the closest I guess to OO although their query api is not natural feeling i.e. not Ruby but I will also check out the pacer gem , perhaps it deals with that as well

thanks

Charles Monteiro
jr...@smallruby.com

Charles Monteiro

unread,
May 17, 2013, 3:01:25 PM5/17/13
to us...@jruby.codehaus.org
thanks, I actually talked to Neo4j , again onerous license, you better have VC if you want to do anything commercial although they did say that "they would look the other way" , contractually you on the hook .


Dolphin is actually quite interesting , i had studied building something along those lines using memory pipes for local interchange

Charles Monteiro


Joshua Ballanco

unread,
May 26, 2013, 8:21:48 AM5/26/13
to us...@jruby.codehaus.org
I'm guessing that your needs will exceed its capabilities… but have you looked at PStore? Its major plus is that it's included with the Ruby standard library by default.

-- 
Joshua Ballanco
Chief Scientist
Burnside Digital
1771 NW Pettygrove Street, Suite 140
Portland, OR 97209

P  +1.866.863.7365
F  +1.877.658.6313

Charles Monteiro

unread,
May 28, 2013, 2:47:27 PM5/28/13
to us...@jruby.codehaus.org
I have used PStore  and probably not , from what I can tell PStore relies on loading the entire file into memory, so I think that a Derby under something like DataMapper should work well enough at least for local personal data 

Charles Monteiro


H. Sasse

unread,
May 28, 2013, 5:00:58 PM5/28/13
to us...@jruby.codehaus.org

I'm not sure if this will meet your requirements, but there is Kirbybase

https://github.com/manveru/KirbyBase

Pure ruby flat file database. I've used it before, but not for a while: I thought it had vanished.

Joel VanderWerf

unread,
May 28, 2013, 6:28:10 PM5/28/13
to us...@jruby.codehaus.org

On 05/28/2013 11:47 AM, Charles Monteiro wrote:
> I have used PStore and probably not , from what I can tell PStore
> relies on loading the entire file into memory, so I think that a Derby
> under something like DataMapper should work well enough at least for
> local personal data

Another suggestion: my FSDB gem:

https://rubygems.org/gems/fsdb

It's an file-backed object database. You can use marshal, yaml, or other
serialization. Each file is loaded entirely, so this may work for you if
you can break up your data into many smaller files.

Colin Surprenant

unread,
May 29, 2013, 8:36:39 AM5/29/13
to JRuby users list
If you can live with a key/value store, take a look at LevelDB https://code.google.com/p/leveldb/ - it is an embeddable DB library. See excellent post by Ilya Grigorik on the subject: http://www.igvita.com/2012/02/06/sstable-and-log-structured-storage-leveldb/

Note that the listed gem in that post will not work with JRuby since it contains C extensions but you can look into these alternatives for Java: 

Looking at the leveldb-ruby gem, it shouldn't be that hard to rewrite the bindings to use FFI. 

Colin
--
@colinsurprenant
Reply all
Reply to author
Forward
0 new messages