Before I was able to use the WEBrick instance started by NetBeans, I need to setup the project to use the jdbc adapter for MySQL. Since I didn't really bother reading much instruction, I encountered quite a few problems.
Here are the steps I used to get everything working.
1. Modify environment.rb and add these lines in right before Rails::Initializer:
if RUBY_PLATFORM =~ /java/
require 'rubygems'
RAILS_CONNECTION_ADAPTERS = %w(jdbc)
end
Rails::Initializer.run do |config|
2. Modify database.yml to use the jdbc adapter. Of course, instead of test_development, you put your own database name there.
development:
adapter: jdbc
driver: com.mysql.jdbc.Driver
username: root
password: password
url: jdbc:mysql://localhost:3306/test_development
3. Download the JDBC driver for MySQL.
Download Connector/J 5.0
Unzip or untar the archive and copy mysql-connector-java-5.0.5-bin.jar to your jruby-0.9.8\lib.
You can find your jruby-0.9.8 directory under
C:\Documents and Settings\<your username>\.netbeans\
I found this step to be quite important because adding the driver to CLASSPATH did not work for me.
NetBeans also exposed more rake tasks than before.
No comments:
Post a Comment