as for now you can do the same with JRuby as with MRI - same DM
configuration. so basically you can choose between Sqlite3, Mysql,
Postgres (maybe oracle and sqlsercver) but the DM adapter for hsqldb,
h2, derby do not exist yet though the DataObject drivers are there.
so setup such a database you just need something like:
require 'dm-core'
DataMapper.setup(:default, "sqlite3:./test.db")
regards Kristian
On Aug 11, 3:06 am, Richard Conroy <richard.con...@gmail.com> wrote:> I am scratching my head here trying to get DataMapper to connect to any l, kind
> Hi,
> I am doing a bit of prototyping with a Sinatra App that uses DataMapper
> (1.0) as the ORM layer.
>
> I am just starting out with it, but in development mode I run the app on a
> JRuby container (Trinidad).
>
> of simple local
> development database (like sqlite3, or any of the JRuby database projects
> like hsqldb, Derby etc.).
>
> Information is very sparse, out of date, or a lot of it applies to earlier
> versions of DataMapper.
>
> Whats the state of JRuby support with DataMapper? There seems to be a bit of
> discussion on using
> it with Google App Engine, but not much else.
>
> Whats the simplest way to get a file based DB recognised in DataMapper with
> JRuby?
>
> regards,
> Richard.
>
> --http://richardconroy.blogspot.com
--
You received this message because you are subscribed to the Google Groups "DataMapper" group.
To post to this group, send email to datam...@googlegroups.com.
To unsubscribe from this group, send email to datamapper+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
> Thanks Kristian,
> I did get it to work through trial and error, but oddly I had to stop using
> sqlite3 and go back to sqlite (which I can gem install under jruby).
For DataMapper, you don't need any of the sqlite3, sqlite sqlite3-ruby or such gems. The only requirement is installing do_sqlite3. This has it's own binding to sqlite3, so it doesn't depend on any other gems.
> Information on what is actually supported is sparse to non-existent, that was
> my biggest problem. I couldn't find any information on whether Java
> specific DB projects were supported at all under datamapper, or whether
> you could get them to work via a JDBC bridge.
All the do_* drivers that are supported on JRuby actually use JDBC to bind to the drivers. So that's the case for do_sqlite3, do_mysql, do_postgres, do_hsqldb, do_h2, do_derby, do_oracle and do_sqlserver. For the database connectivity, you don't need anything besides those gems.
The whole gem installation process should therefore also be universal across different Ruby VM's. gem install datamapper dm-sqlite-adapter will install the necessary things for the relevant system. If this is not the case for you, or if this should be documented better, please let us know.
--
Regards,
Dirkjan Bussink