Forum: JRuby database.yml file using JRuby

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joseph A. (Guest)
on 2009-01-29 06:16
(Received via mailing list)
Just wondering what people do with their database.yml files in their
Rails
projects when using JRuby?  Typically I put mine together like this:

development:
  adapter: <%= RUBY_PLATFORM =~ /java/ ? 'jdbc' : '' %>mysql
  encoding: utf8
  database: myapp_development
  pool: 5
  username: root
  password:
  host: localhost


So when I use MRI I don't have to change anything in the file.  But do
most
people that use JRuby use it exclusively?  Or do you do something
similar?
Thanks.

Joe
Wes G. (Guest)
on 2009-01-29 06:33
(Received via mailing list)
I think this is a good approach.  I haven't done it yet, but I've only
recently gotten turned on to Erb in my Yaml files.

Joseph A. wrote:
>   host: localhost
>
>
> So when I use MRI I don't have to change anything in the file.  But do
> most people that use JRuby use it exclusively?  Or do you do something
> similar?  Thanks.
>
> Joe

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

    http://xircles.codehaus.org/manage_email
Rich M. (Guest)
on 2009-01-29 06:50
(Received via mailing list)
I switch between mysql and oracle in my dev env (we run orcl for prod so
I
have to test it once in a while :-)).

development: &development
<% unless defined?(JRUBY_VERSION)  %>
  adapter: mysql
  database: myapp_development
  host: localhost
  username: user
  password: pwd
<% else %>
  username: myapp_development
  password: pwd
  adapter: jdbc
  driver: oracle.jdbc.driver.OracleDriver
  url: jdbc:oracle:thin:@127.0.0.1:1521:xe
<% end %>
Mwadhera M. (Guest)
on 2009-01-29 07:06
(Received via mailing list)
We do the same in our database.yml -- though I favor the
defined?(JRUBY_VERSION) for checking for JRuby. I also think thats the
convention the authors of JRuby Cookbook recommend.

On Wed, Jan 28, 2009 at 8:49 PM, Rich M. <removed_email_address@domain.invalid>
wrote:
> <% else %>
>> recently gotten turned on to Erb in my Yaml files.
>>>  pool: 5
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>   http://xircles.codehaus.org/manage_email
>>
>>
>
>



--
Best,

Mike W.
http://metasaur.us

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

    http://xircles.codehaus.org/manage_email
Joseph A. (Guest)
on 2009-01-29 18:38
(Received via mailing list)
This is good information thanks.  So if one were to run the Rails
command
like:
rails my_app -d jdbcmysql

Would you want to get a database.yml file created that only works for
jdbcmysql?  Or one that uses the defined?(JRUBY_VERSION) trick to
accommodate both JRuby and MRI?

Joe
This topic is locked and can not be replied to.