Rails jruby +activerecord-jdbcmysql-adapter 总是提示 找不到 Mysql2

pengalg · December 08, 2014 · Last by jimrokliu replied at December 08, 2014 · 1793 hits

NameError: uninitialized constant Mysql2

在 database.yml 中,已经写了

development: adapter: mysql2

然后 Gemfile 中写的是

gem 'activerecord-jdbcmysql-adapter', :platform => :jruby

查看 gemlist,上述 gem 是存在的,然后跟踪代码发现是

def retrieve_connection connection_handler.retrieve_connection(self) end

这个里面跑出了 ConnectionNotEstablished 异常

本地命令 mysql -uroot -proot 正常

只用 mysql 就行了吧。

jruby 需要用 jdbc 的驱动才能使用 mysql 的

写 mysql 就行。

You need to Sign in before reply, if you don't have an account, please Sign up first.