2013-04-09 172 views
1

Hy,jruby jruby on rails with jdbc

我是JRuby on Rails中的一名新成員。我安裝RadRails的和許多寶石:

件的寶石

  • 了activerecord(2.3.4)
  • 的ActiveRecord-JDBC(0.5)
  • 了activerecord-JDBC適配器(1.2.9)
  • 了activerecord-jdbcmysql適配器(1.2.9)
  • jdbcmysql(5.1.24)

書:http://koti.kapsi.fi/jamo/priv2/JRuby%20on%20Rails,%202007.pdf

我閱讀以下部分在第四章名爲「存儲管理」和我修改配置/ database.yml,以這樣的:

development: 
    adapter: jdbc 
    driver: com.mysql.jdbc.Driver 
    url: jdbc:mysql://my_host/my_database 
    username: my_user 
    password: my_pass 

我加入到構建以下路徑:

C:\Program Files\Aptana RadRails\plugins\org.jruby_1.2.0.9419p2\lib\ruby\gems\1.8\gems\jdbc-mysql-5.1.24\ 

當我重新啓動我得到了以下錯誤的服務器:

Status: 500 Internal Server Error 
    The driver encountered an error: cannot load Java class com.mysql.jdbc.Driver 
    C:/Program Files/Aptana RadRails/plugins/org.jruby_1.2.0.9419p2/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:265:in `initialize' 
    C:/Program Files/Aptana RadRails/plugins/org.jruby_1.2.0.9419p2/lib/ruby/gems/1.8/gems/ActiveRecord-JDBC-0.5/lib/active_record/connection_adapters/jdbc_adapter.rb:41:in `jdbc_connection' 

我想問你的幫忙。

回答

0

您是否已將jdbc jar添加到您的類路徑中?嘗試將jar文件直接複製到jruby安裝下的lib目錄中。

例如C:\jruby\lib\mysql-jdbc.jar