Forum: Ruby Segmentation fault trying to query MySQL

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ben (Guest)
on 2009-01-12 19:35
(Received via mailing list)
Hi all,

I'm trying to use DBI to connect to MySQL from ruby. Unfortunately, as
soon as I use execute to try to send a query, it seg-faults. Here's a
sample of code which does this:

require 'rubygems'
gem 'mysql'
gem 'dbi'
require 'dbi'
require 'mysql'

dsn = ""
dbh = DBI.connect(dsn, "USERNAME", "PASSWORD")

sth = dbh.execute("select  * from pm limit 10;")

I've checked the value of dbh, and it's not nil, and looks fine. No
exceptions are thrown, as I've checked for that too. I'm running this
on Windows - not sure if that makes a difference?

Does anyone know what I'm doing wrong?


Luis L. (Guest)
on 2009-01-13 00:20
(Received via mailing list)
On Jan 12, 3:31 pm, Ben <removed_email_address@domain.invalid> wrote:
> require 'mysql'
> Does anyone know what I'm doing wrong?
What is your ruby version?

Can you provide more information about the MySQL version (more
importantly the libmysql.dll that is in the path, which version it is?
This topic is locked and can not be replied to.