Forum: JRuby using pg and mysql gems on jruby-head?

Dabfeaeaab8676bbe47876669e3d549a?d=identicon&s=25 Dan F (Guest)
on 2012-06-22 21:19
(Received via mailing list)
I filed enebo said, "Try
jruby-1.7.0.pre1". Okay. I am looking to see if jruby is faster for my
CPU-bound long-running process (15 minutes for the short version).

I installed Java 7. I did "rvm install jruby-head". I tried "bundle" to
install my gems, and it barfed on "mysql" and "pg" (at least) because
are native extensions, even after I threw caution to the wind and put
"cext.enabled=true" in my .jrubyrc. However, I need to access postgres
mysql. Google revealed sometimes there are alternative gems for jruby,
suggested plans for supporting native extensions in newer versions of
jruby, but I can't find details on either.

What is the state of this? Can I install pg and mysql gems somehow, must
abandon attempts at jruby, or is there hidden option c? Please don't ask
to significantly rewrite my source tree (e.g., change require
especially if it leaves it ruby-incompatible.

Thanks for your attention.
Dabfeaeaab8676bbe47876669e3d549a?d=identicon&s=25 Dan F (Guest)
on 2012-06-22 21:21
(Received via mailing list)
Oh, the detailed error message:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native

        /Users/me/.rvm/rubies/jruby-head/bin/jruby extconf.rb
/Users/me/.rvm/rubies/jruby-head/lib/ruby/shared/mkmf.rb:14: Use
instead of obsolete and deprecated Config.
mkmf.rb can't find header files for ruby at
302c6c56b99912a673f1213b0709c902?d=identicon&s=25 Alex Tambellini (Guest)
on 2012-06-22 21:24
(Received via mailing list)
You need to use the jdbc adapters when using jruby:
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2012-06-22 21:26
I typically use "pure java" gems or wrap JDBC myself.
For rails it doesn't require "much" code change:
27079559125269ea0a30acba3fb06235?d=identicon&s=25 Dan Frankowski (Guest)
on 2012-06-22 21:43
(Received via mailing list)
Thanks for your suggestions.

I am using the 'sequel' gem. says: "Legacy
If you use one of the convenience activerecord-jdbcXXX-adapter adapters,
you can still put a jdbc prefix in front of the database adapter name as

$ gem install activerecord-jdbcpostgresql-adapter
Fetching: activerecord-jdbc-adapter-1.2.2.gem (100%)
Fetching: jdbc-postgres-9.1.901.gem (100%)
Fetching: activerecord-jdbcpostgresql-adapter-1.2.2.gem (100%)
Successfully installed activerecord-jdbc-adapter-1.2.2
Successfully installed jdbc-postgres-9.1.901
Successfully installed activerecord-jdbcpostgresql-adapter-1.2.2
3 gems installed

Tried adapter of "jdbcpostgresql". I get:

Sequel::AdapterNotFound: LoadError: no such file to load --
  chained_4_rescue_line_25 at

Looked in dir:

$ ls

So how do I choose the right adapter for sequel?

Thanks for your attention.
0f36963d10e423a204db6aa255fd308f?d=identicon&s=25 Rohit Namjoshi (Guest)
on 2012-06-23 01:39
(Received via mailing list)
Hi Dan

You should be asking this question on the Sequel Google group!forum...

Since you are using Sequel and not AR you need to install the
gem, I would uninstall activerecord-jdbcpostgresql-adapter first. The
should be of the form jdbc:postgresql://<host>/<database>. More details

27079559125269ea0a30acba3fb06235?d=identicon&s=25 Dan Frankowski (Guest)
on 2012-06-27 19:01
(Received via mailing list)
Although technically you are correct (this is about using sequel), it is
barrier to using jruby. I would think if the jruby community wants to
support users, it would be good to have a ready answer to what seems a
common question to me.
27079559125269ea0a30acba3fb06235?d=identicon&s=25 Dan Frankowski (Guest)
on 2012-06-27 19:02
(Received via mailing list)
Also, I am not using a URI. As stated, I am using an adapter, i.e.
Sequel.connect with :host, :database, :user, :port, :adapter parameters.
0f36963d10e423a204db6aa255fd308f?d=identicon&s=25 Rohit Namjoshi (Guest)
on 2012-06-28 00:17
(Received via mailing list)
The advantage of using a uri is that you can append any connection
options supported by the postgres jdbc driver to the uri string.

Sequel.connect(:adapter  => 'jdbc',
      :username => 'xxx',
      :password => 'xxx',
      :uri      => 'jdbc:postgresql://localhost;database=xyz')
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.