from http://blogs.sun.com/divas/entry/no_such_file_to_load
Rails never fails me. As soon as I publish a series of tutorials for a NetBeans release, a new Rails release comes out which breaks my tutorials (and, apparently, most everyone else’s). Gratefully, some customers took the time to click the Feedback button at the end of our tutorials to let us know the tutorials were no longer working. One customer wrote:
“When trying to create the database following the steps indicated, I got an error indicating the mysql gem had been removed from Rails 2.2.2 and that I should install the mysql gem. (Note from me: the actual error message is “The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.”) However, that gem is also native and can’t be installed with JRuby (the misleading directive to do so from NetBeans was really annoying).”
I have to agree that this is indeed REALLY annoying. However, the “misleading directive” comes from Rails, and not from NetBeans. And, since Rails 2.2 came out after NetBeans 6.5, this was an unexpected message.
While the directive may be true for Ruby, it is not true for JRuby, because the the MySQL adapter is included with JRuby. In addition, as the user pointed out, you can’t install the mysql gem with JRuby because you cannot use any gems that build native C libraries during the install process, and that includes the mysql gem.
I did some googling and found two solutions:
- Use the activerecord-jdbcmysql-adapter. You can find the instructions on how to do that here.
- Copy the MySQL driver to your project’s lib folder. If you have an older Rails version, you can copy the Ruby MySQL driver (mysql.rb) from rails-install-dir/gems/activerecord-version/lib/active_record/vendor/mysql.rb to the project’s lib directory. Unfortunately, you have to do this for every JRuby project.
If anyone else has any other solutions, please post a comment.
P.S. For all you Ruby programmers, when you try out a tutorial, you really should pay attention to what gem versions the tutorial was written for. Gem releases such as Rails and RSpec are not always backwards compatible, so there is a chance that the tutorial will not work with releases that came out after the tutorial was written.

Description: Hello, Consider the following code: PreparedStatement ps = connection.prepareStatement("INSERT INTO table values(?,?)"); ps.setInt(1,value1); ps.setInt(2,value2); ps.executeUpdate(); ResultSet rs = ps.getGeneratedKeys(); // This throws a java.sql.SQLException: !Statement.GeneratedKeysNotRequested! Even when creating the PreparedStament in this other way the same exception is thrown: PreparedStatement ps = connection.prepareStatement("INSERT INTO table values(?,?)",PreparedStatement.RETURN_GENERATED_KEYS); ps.setInt(1,value1); ps.setInt(2,value2); ps.executeUpdate(); ResultSet rs = ps.getGeneratedKeys(); // This ALSO throws a java.sql.SQLException: !Statement.GeneratedKeysNotRequested! According to some posts I read on the Internet, this might be related to Bug #34185, as it seems was pushed into the current 5.1.7 version and the problem didn't happen before. I guess the problem just occurs when using PreparedStaments, as with Statements you can provide the RETURN_GENERATED_KEYS flag when executing the query. However, flags for PreparedStaments can only be provided when "Preparing the Statement". So the following code works well: Statement stmt = connection.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,java.sql.ResultSet.CONCUR_ READ_ONLY); stmt.executeUpdate("INSERT INTO table values(1,2)",Statement.RETURN_GENERATED_KEYS); ResultSet rs = stmt.getGeneratedKeys(); //This works This is breaking lots of apps, and should be fixed as soon as possible. Thank you very much!! How to repeat: See description!