Database.yml file using JRuby


#1

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


#2

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

#3

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 %>


#4

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


#5

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