[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Segmentation fault trying to query MySQL

Ben

1/12/2009 5:31:00 PM

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
1 Answer

Luis Lavena

1/12/2009 10:17:00 PM

0

On Jan 12, 3:31 pm, Ben <cop...@gmail.com> wrote:
> 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?

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?

--
Luis Lavena