Newbie - Problem One - Ruby and MySQL

I have ruby, apache and MySQL installed via instantrailson Windows XP
sp2. All work independently OK.

I am attempting to access the MySQL, but up to now no success.

After searching the web. have tried

require ‘dbi’

require ‘mysql’

but both have not been found. What is the correct require ‘’ and a
pointer to a code snippet, which connected to a database and select
rows would be most helpful.

It may be something to do with 'activerecord, but
require ‘active_record’ does not find any code either.

Thanks

Richard

There is no native Ruby to MySQL adapter under Windows. That is why
each of the pieces work independently, but you are frustrated. (This is
why I use Sqlite3 instead of MySQL) You can build your own adapter
under Cygwin, apparently, but I think it’s too much pain for the
reward.

If you must, here’s the link from the guy who wrote a book on MySQL …
http://www.kitebird.com/articles/ruby-mysql.html
Search for the word “Windows”.

And here’s some complex (but good?) instructions on how to set up the
whole enchilada for Eclipse, which seems to include a way to get at the
database without Cygwin. The JDBC connector seems to be involved - not
sure. …
http://www.napcs.com/howto/railsonwindows.html

Hope this helps — And if you do decide to build some adapter for
Windows, upload it for us :wink:

If it is a gem you should do:

require ‘rubygems’
require ‘mysql’ (etc)

If im not mistake you should adjust your RUBY_LIB env path to point to
your site_ruby directory. (so require can find packages ok)

  • Jon