# Newbie - Problem One - Ruby and MySQL

**URL:** <https://www.ruby-forum.com/t/newbie-problem-one-ruby-and-mysql/56163>\
**Category:** Ruby\
**Created:** [January 4, 2006, 10:56pm UTC](https://www.ruby-forum.com/t/newbie-problem-one-ruby-and-mysql/56163 "2006-01-04T22:56:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 4, 2006, 10:56pm UTC](https://www.ruby-forum.com/t/newbie-problem-one-ruby-and-mysql/56163/1 "2006-01-04T22:56:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 5, 2006, 1:00am UTC](https://www.ruby-forum.com/t/newbie-problem-one-ruby-and-mysql/56163/2 "2006-01-05T01:00:27Z")

</div>

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](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](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 😉

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [January 5, 2006, 2:39am UTC](https://www.ruby-forum.com/t/newbie-problem-one-ruby-and-mysql/56163/3 "2006-01-05T02:39:41Z")

</div>

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
