开发者

Ruby Mysql Crashing

开发者 https://www.devze.com 2023-01-22 11:19 出处:网络
My ruby code crashes on this code puts \"one\" con = Mysql.real_connect(\'localhost\', \'user\', \'pass\', \'database\')

My ruby code crashes on this code

puts "one"
con = Mysql.real_connect('localhost', 'user', 'pass', 'database')
put开发者_如何学Pythons "two"

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消