MySQL Forums
Forum List  »  Ruby

sequel gem and segfault - mysql gem line 343
Posted by: dave lilley
Date: December 14, 2010 03:55AM

hi there,

using 1.8.7 p302 via rubyinstaller

I can connect to a remote MYSQL server fine via mysql - trouble is i'm converting a linux app to windows and I have sequel code embedded throughout my project.

I have 1 script that handles the sql calls below is a sample of what the class initialization method does and the errors generated.

anyone able to help? (prefer to use sequel gem to save LOTS of recoding/debugging).

converting on WINXP virtual machine end OS is going to be W2K pro - win XP systems.

Doesn't seem to matter where i have the line - get_all_acccodes.each{|c| puts c}
it will segfault anyway.

the version of LIBmysql.dll is one I got from
that file is 1.484Kb large and i have another that is like 242Kb this one also segfaults too.

sample code being used...

require 'sequel'
require 'logger'
# require 'mysql'

class Dopen

def initialize(*arg)
@path = "/logs"
@log ="#{@path}DB - info.log")
@log.level = Logger::DEBUG

@log.debug('initialing the DB access!')

if arg[0] == 'local'
#was only used for test via my local server - i want to connect to the remote server only now!
puts 'in remote side'
@db = Sequel.mysql(:host => '', :user => "user", :password => "p/word", :database => "database", :logger => STDOUT ))

# test.each{|r| puts r} <<< 1st errors belong to this line - line 22

get_all_acccodes.each{|c| puts c} <<< 2nd errors belong to this line

# this connection code works fine below!!!
# @db ='', "user", "p/word",'database')
# remote

rescue Sequel::Error
@log.debug("An error occurred\nError code: #{Sequel}\nError message: #{Sequel.to_s}")
@log.debug("DB closed!")
# @db.close if @db


def get_all_acccodes
@log.debug('getting all account codes')
@db[:cust_data].filter(:closed => 0, :contract => 0) # 1 = true account is CLOSED, 0 means it's OPEN

#line below works with mysql direct
# @db.query("select * from cust_data where closed = 0 and contract = 0")


a = 'remote' << allows for quick switching when i was developing locally

*** end of teh script file ****

Now if I change the connect line from Sequel.mysql(...) to Sequel.mysql.connect(...) i get a reference to as per error 3 - No user or password for Dave @ localhost!!!

I'm not conecting to a local host.

I do have Mysql community installed but will need to remove it to gain disk space back, I only did this because originally i couldn't even connect to the remote Mysql server and I thought i might need it locally.

any pointers on what I'm doing wrong?

many thanks for any - all help.


1st errors for simple show version of server being run....

C:\monitoring screen>ruby -rubygems sequel1.rb
in remote side
I, [2010-12-14T22:54:15.335004 #2740] INFO -- : (0.190273s) SET @@wait_timeout
= 2147483
I, [2010-12-14T22:54:15.535292 #2740] INFO -- : (0.200288s) SET SQL_AUTO_IS_NUL
I, [2010-12-14T22:54:15.715552 #2740] INFO -- : (0.180260s) SELECT VERSION()
sequel1.rb:22:in `initialize': undefined method `each' for nil:NilClass (NoMetho
from sequel1.rb:159:in `new'
from sequel1.rb:159

C:\monitoring screen>

2nd error

C:\monitoring screen>ruby -rubygems sequel1.rb
in remote side
I, [2010-12-14T22:55:11.310100 #2776] INFO -- : (0.190273s) SET @@wait_timeout
= 2147483
I, [2010-12-14T22:55:11.500374 #2776] INFO -- : (0.190274s) SET SQL_AUTO_IS_NUL
I, [2010-12-14T22:55:11.710676 #2776] INFO -- : (0.210302s) SELECT * FROM `cust
_data` WHERE ((`closed` = 0) AND (`contract` = 0))
: [BUG] Segmentation fault
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\monitoring screen>

3rd error output...

C:\monitoring screen>ruby -rubygems sequel1.rb
in remote side
:in `real_connect': Access denied for user 'dave'@'localhost' (using password: N
O) (Mysql::Error)
from C:/Ruby187/lib/ruby/gems/1.8/gems/sequel-3.18.0/lib/sequel/adapters
/mysql.rb:112:in `connect'
from sequel1.rb:20:in `initialize'
from sequel1.rb:160:in `new'
from sequel1.rb:160

C:\monitoring screen>

Options: ReplyQuote

Written By
sequel gem and segfault - mysql gem line 343
December 14, 2010 03:55AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.