I am working on a small sintra app and using jruby and datamapper. I
used
ruby and this worked fine as well as deployed to heroku which also
works. I
copied the code over to a jruby machine and i can’t seem to get the
DataMapper code to work. I know that i need extra libraries for sqlite3
to
work under jruby but i am unable to get datamapper to see or create my
database. It tells me it cant find the database and i get a “can’t
connect”
error. Further down the trace i get another message saying " ‘\’ does
not
exist (code: , sql state: , query: , uri: )". I have no idea what this
refers to. I am using DataMapper.setup(:default,
“sqlite3://#{Dir.pwd}/db/database.db”).
Any ideas?
1/ for the db url, since this is jruby, you should go for jdbc sqlite
driver => ‘jdbc:sqlite:etc…’. You’ll need a jdbc driver (like
sqlite-jdbc-3.7.2.jar, just google for it)
2/ drop sqlite for h2 database since you’re using jruby: you should
get a much faster db this way, without breaking your code (at least
with sequel it works out of the box).
Currently, I’m doing some sinatra dev with jruby/h2 and mri/sqlite.
. I know that i need extra libraries for sqlite3 to work under jruby but i
am unable to get datamapper to see or create my database.
so first you need to make sure you do install the java versions of the
dataobjects gems. probably something like “jruby -S gem update
do_sqlite3” shall do.
On Tue, Aug 9, 2011 at 12:45 AM, Christian MICHON [email protected] wrote:
“sqlite3://#{Dir.pwd}/db/database.db”).
sqlite-jdbc-3.7.2.jar, just google for it)
2/ drop sqlite for h2 database since you’re using jruby: you should
get a much faster db this way, without breaking your code (at least
with sequel it works out of the box).
Currently, I’m doing some sinatra dev with jruby/h2 and mri/sqlite.
–
Christian
Regarding my 2 points: I did not check if dm-core would support jdbc
adapters out of the box, especially h2 over jdbc.
I am working on a small sintra app and using jruby and datamapper. I
used
ruby and this worked fine as well as deployed to heroku which also
works. I
copied the code over to a jruby machine and i can’t seem to get the
DataMapper code to work. I know that i need extra libraries for sqlite3
to
work under jruby but i am unable to get datamapper to see or create my
database. It tells me it cant find the database and i get a “can’t
connect”
error. Further down the trace i get another message saying " ‘\’ does
not
exist (code: , sql state: , query: , uri: )". I have no idea what this
refers to. I am using DataMapper.setup(:default,
“sqlite3://#{Dir.pwd}/db/database.db”).
Any ideas?
Thanks,
–Nick
I’m getting this problem as well. I’m on Windows. Something is stripping
out a colon (from “c:/…”). On a hunch I removed the “//” part of the
connection string and it worked fine:
“sqlite3:#{Dir.pwd}/db/database.db”.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.