@@ -61,27 +61,22 @@ If you're using Rails 3, you'll need to modify your *Gemfile* to use the
6161like the following (using MySQL as an example):
6262
6363``` ruby
64- gem ' mysql' , platform: :ruby
65-
66- platforms :jruby do
67- gem ' jruby-openssl'
68- gem ' activerecord-jdbcmysql-adapter'
69- end
64+ gem ' mysql2' , platform: :ruby
65+ gem ' activerecord-jdbcmysql-adapter' , platform: :jruby
7066```
7167
72- If you're using Rails 2.3:
68+ If you're (stuck) using Rails 2.3:
7369
7470 jruby script/generate jdbc
7571
76723 . Configure your * database.yml* in the normal Rails style:
7773
7874``` yml
7975development :
80- adapter : mysql
76+ adapter : mysql2 # or mysql
77+ database : blog_development
8178 username : blog
8279 password : 1234
83- host : localhost
84- database : blog_development
8580` ` `
8681
8782**Legacy Configuration:** If you use one of the *activerecord-jdbcxxx-adapter*
@@ -95,7 +90,7 @@ class and URL (do not forget to put the driver .jar(s) on the class-path) e.g.:
9590development:
9691 adapter: jdbc
9792 username: blog
98- password:
93+ password: 1234
9994 driver: com.mysql.jdbc.Driver
10095 url: jdbc:mysql://localhost:3306/blog_development
10196` ` `
@@ -105,12 +100,12 @@ correct adapter type will be automatically detected):
105100
106101` ` ` yml
107102production:
108- adapter: jdbc
109- jndi: jdbc/PostgreDB
103+ adapter: jndi # jdbc
104+ jndi: jdbc/PostgreDS
110105` ` `
111106
112107JDBC driver specific properties might be set if you use an URL to specify the DB
113- or using the *properties:* syntax (available since AR-JDBC **1.2.6**) :
108+ or using the *properties:* syntax :
114109
115110` ` ` yml
116111production:
@@ -128,31 +123,32 @@ If you're really old school you might want to use AR-JDBC with a DB2 on z/OS:
128123` ` ` yml
129124development:
130125 adapter: jdbc
131- encoding: unicode
132126 url: jdbc:db2j:net://mightyzoshost:446/RAILS_DBT1
133127 driver: com.ibm.db2.jcc.DB2Driver
134128 schema: DB2XB12
135129 database: RAILS_DB1
136130 tablespace: TSDE911
137131 lob_tablespaces:
138132 first_table: TSDE912
139- username: scott
140- password: lion
133+ username: business
134+ password: machines
135+ encoding: unicode
141136` ` `
142137
143- If your SGBD isn't automatically discovered you can force a dialect as well :
138+ If your SGBD isn't automatically discovered you can force a (DB2) dialect :
144139
145140` ` ` yml
146141development:
147- [ ...]
148- dialect: as400 # For example
142+ # ... previous configuration
143+ dialect: as400 # for example
149144` ` `
150145
151146More information on (configuring) AR-JDBC might be found on our [wiki][5].
152147
153148# ## Standalone with ActiveRecord
154149
155- Once the setup is made (see below) you can establish a JDBC connection like this (e.g. for `activerecord-jdbcderby-adapter`) :
150+ Once the setup is made (see below) you can establish a JDBC connection like this
151+ (e.g. for `activerecord-jdbcderby-adapter`) :
156152
157153` ` ` ruby
158154ActiveRecord::Base.establish_connection(
@@ -161,7 +157,7 @@ ActiveRecord::Base.establish_connection(
161157)
162158` ` `
163159
164- or using (requires that you manually put the driver jar on the classpath ) :
160+ or using (requires that you manually put the driver jar on the class-path ) :
165161
166162` ` ` ruby
167163ActiveRecord::Base.establish_connection(
@@ -173,11 +169,11 @@ ActiveRecord::Base.establish_connection(
173169
174170# ### Using Bundler
175171
176- Proceed as with Rails; specify the ActiveRecord gem in your Bundle along with
177- the chosen ( JDBC) adapters this time sample *Gemfile* for MySQL :
172+ Proceed as with Rails; specify ` ActiveRecord` in your Bundle along with the
173+ chosen JDBC adapter(s), this time sample *Gemfile* for MySQL :
178174
179175` ` ` ruby
180- gem 'activerecord', '~> 3.2.13 '
176+ gem 'activerecord', '~> 3.2.14 '
181177gem 'activerecord-jdbcmysql-adapter', :platform => :jruby
182178` ` `
183179
0 commit comments