Segmentation fault trying to query MySQL

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 = “DBI:Mysql:DATABASE:www.HOSTNAME.net”
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?

Thanks,

Ben

On Jan 12, 3:31 pm, Ben [email protected] 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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs