Most of the strange parts in
how Rails uses ActiveRecord are things that work well with MySQL. So, for many applications
MySQL should be an easy choice. The configuration of a MySQL database in Rails is also
straightforward. (You??™ve already done it once for the Shoplet application.) A sample configuration
should look like this:
development:
adapter: jdbc
driver: com.mysql.jdbc.Driver
CHAPTER 5 ?– A DATABASE-DRIVEN SHOP 90
url: jdbc:mysql://localhost:3306/ar_test
username: ar_user
password: ar_pass
All information will be familiar here if you??™ve used JDBC before. The only strange part is
the adapter, and that will be the same for all configurations of AR-JDBC. In fact, that definition
tells ActiveRecord to use AR-JDBC instead of something else.
The driver parameter points to the regular JDBC driver class name. It??™s important that
this class can be found on JRuby??™s CLASSPATH; otherwise it won??™t be found and Rails won??™t work.
The url parameter works in exactly the same way as with regular JDBC. The big difference
is that you need separate username and password parameters for AR-JDBC. Because that URL
is what gets sent to the JDBC driver, you can also include configuration settings in it, if you
need the connection toMySQL handled in a different way from the defaults.
Oracle SQL
Next to MySQL and PostgreSQL, Oracle database support is the one that works best in ARJDBC.
The configuration is more or less exactly the same as the one for MySQL:
development:
adapter: jdbc
driver: oracle.
Pages:
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174