tags:

views:

23

answers:

1

My ruby code crashes on this code

puts "one"
con = Mysql.real_connect('localhost', 'user', 'pass', 'database')
puts "two"

It outputs one but not two?? Why isn't it executing any further

A: 

Add require "mysql" at the beginning.

Also check if you can connect to your database (other than from ruby), just to check that its actually running.

EDIT:
Also, use exception handling to catch these subtle errors.

Sujoy
Oops it was that. I had commented it.
Will03uk