Skip to content

Commit

Permalink
Add generic 'jdbc' database option
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Jun 21, 2011
1 parent e1d6667 commit 198cd8b
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 4 deletions.
9 changes: 5 additions & 4 deletions railties/lib/rails/generators/app_base.rb
Expand Up @@ -10,7 +10,7 @@ module Rails
module Generators
class AppBase < Base
DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql )
JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
DATABASES.concat(JDBC_DATABASES)

attr_accessor :rails_template
Expand Down Expand Up @@ -157,9 +157,10 @@ def gem_for_database
when "postgresql" then "pg"
when "frontbase" then "ruby-frontbase"
when "mysql" then "mysql2"
when "jdbcmysql" then "activerecord-jdbcmysql-adapter"
when "jdbcsqlite3" then "activerecord-jdbcsqlite3-adapter"
when "jdbcpostgresql" then "activerecord-jdbcpostgresql-adapter"
when "jdbcmysql" then "activerecord-jdbcmysql-adapter"
when "jdbcsqlite3" then "activerecord-jdbcsqlite3-adapter"
when "jdbcpostgresql" then "activerecord-jdbcpostgresql-adapter"
when "jdbc" then "activerecord-jdbc-adapter"
else options[:database]
end
end
Expand Down
@@ -0,0 +1,62 @@
# If you are using mssql, derby, hsqldb, or h2 with one of the
# ActiveRecord JDBC adapters, install the appropriate driver, e.g.,:
# gem install activerecord-jdbcmssql-adapter
#
# Configure using Gemfile:
# gem 'activerecord-jdbcmssql-adapter'
#
#development:
# adapter: mssql
# username: <%= app_name %>
# password:
# host: localhost
# database: <%= app_name %>_development
#
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
#
#test:
# adapter: mssql
# username: <%= app_name %>
# password:
# host: localhost
# database: <%= app_name %>_test
#
#production:
# adapter: mssql
# username: <%= app_name %>
# password:
# host: localhost
# database: <%= app_name %>_production

# If you are using oracle, db2, sybase, informix or prefer to use the plain
# JDBC adapter, configure your database setting as the example below (requires
# you to download and manually install the database vendor's JDBC driver .jar
# file). See your driver documentation for the apropriate driver class and
# connection string:

development:
adapter: jdbc
username: <%= app_name %>
password:
driver:
url: jdbc:db://localhost/<%= app_name %>_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.

test:
adapter: jdbc
username: <%= app_name %>
password:
driver:
url: jdbc:db://localhost/<%= app_name %>_test

production:
adapter: jdbc
username: <%= app_name %>
password:
driver:
url: jdbc:db://localhost/<%= app_name %>_production

0 comments on commit 198cd8b

Please sign in to comment.