Skip to content
This repository
Browse code

Add generic 'jdbc' database option

  • Loading branch information...
commit 198cd8bcc105faeb7e89ce1744ff60e3efaa929a 1 parent e1d6667
Nick Sieger authored June 20, 2011
9  railties/lib/rails/generators/app_base.rb
@@ -10,7 +10,7 @@ module Rails
10 10
   module Generators
11 11
     class AppBase < Base
12 12
       DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
13  
-      JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql )
  13
+      JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
14 14
       DATABASES.concat(JDBC_DATABASES)
15 15
 
16 16
       attr_accessor :rails_template
@@ -157,9 +157,10 @@ def gem_for_database
157 157
         when "postgresql" then "pg"
158 158
         when "frontbase"  then "ruby-frontbase"
159 159
         when "mysql"      then "mysql2"
160  
-        when "jdbcmysql"  then "activerecord-jdbcmysql-adapter"
161  
-        when "jdbcsqlite3"  then "activerecord-jdbcsqlite3-adapter"
162  
-        when "jdbcpostgresql"  then "activerecord-jdbcpostgresql-adapter"
  160
+        when "jdbcmysql"      then "activerecord-jdbcmysql-adapter"
  161
+        when "jdbcsqlite3"    then "activerecord-jdbcsqlite3-adapter"
  162
+        when "jdbcpostgresql" then "activerecord-jdbcpostgresql-adapter"
  163
+        when "jdbc"           then "activerecord-jdbc-adapter"
163 164
         else options[:database]
164 165
         end
165 166
       end
62  railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml
... ...
@@ -0,0 +1,62 @@
  1
+# If you are using mssql, derby, hsqldb, or h2 with one of the
  2
+# ActiveRecord JDBC adapters, install the appropriate driver, e.g.,:
  3
+#   gem install activerecord-jdbcmssql-adapter
  4
+#
  5
+# Configure using Gemfile:
  6
+#   gem 'activerecord-jdbcmssql-adapter'
  7
+#
  8
+#development:
  9
+#  adapter: mssql
  10
+#  username: <%= app_name %>
  11
+#  password:
  12
+#  host: localhost
  13
+#  database: <%= app_name %>_development
  14
+#
  15
+# Warning: The database defined as "test" will be erased and
  16
+# re-generated from your development database when you run "rake".
  17
+# Do not set this db to the same as development or production.
  18
+#
  19
+#test:
  20
+#  adapter: mssql
  21
+#  username: <%= app_name %>
  22
+#  password:
  23
+#  host: localhost
  24
+#  database: <%= app_name %>_test
  25
+#
  26
+#production:
  27
+#  adapter: mssql
  28
+#  username: <%= app_name %>
  29
+#  password:
  30
+#  host: localhost
  31
+#  database: <%= app_name %>_production
  32
+
  33
+# If you are using oracle, db2, sybase, informix or prefer to use the plain
  34
+# JDBC adapter, configure your database setting as the example below (requires
  35
+# you to download and manually install the database vendor's JDBC driver .jar
  36
+# file). See your driver documentation for the apropriate driver class and
  37
+# connection string:
  38
+
  39
+development:
  40
+  adapter: jdbc
  41
+  username: <%= app_name %>
  42
+  password:
  43
+  driver:
  44
+  url: jdbc:db://localhost/<%= app_name %>_development
  45
+
  46
+# Warning: The database defined as "test" will be erased and
  47
+# re-generated from your development database when you run "rake".
  48
+# Do not set this db to the same as development or production.
  49
+
  50
+test:
  51
+  adapter: jdbc
  52
+  username: <%= app_name %>
  53
+  password:
  54
+  driver:
  55
+  url: jdbc:db://localhost/<%= app_name %>_test
  56
+
  57
+production:
  58
+  adapter: jdbc
  59
+  username: <%= app_name %>
  60
+  password:
  61
+  driver:
  62
+  url: jdbc:db://localhost/<%= app_name %>_production

0 notes on commit 198cd8b

Please sign in to comment.
Something went wrong with that request. Please try again.