Project

General

Profile

Actions

Bug #5175

closed

Ruby1.9.2p290 MySQLアクセスエラー

Added by e_maekawa (eiichi maekawa) over 12 years ago. Updated over 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
Backport:
[ruby-dev:44362]

Description

下記エラーは、RUBY1.9.2p180mingw、Ruby1.8.7p334mingwでは、生じません。
MySQL関連gemインストール
D:>pik list
187: ruby 1.8.7 (2010-12-23 patchlevel 330) [i386-mswin32]
187: ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32]
187: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
192: ruby 1.9.2p136 (2010-12-25 revision 30365) [i386-mswin32]
192: ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
192: ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

D:>pik sw 192 290

D:>cd d:\Ruby192p290

D:\Ruby192p290>gem install dbi-0.4.5.gem --no-ri --no-rdoc --local
Successfully installed deprecated-2.0.1
Successfully installed dbi-0.4.5
2 gems installed

D:\Ruby192p290>

D:\Ruby192p290>ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

D:\Ruby192p290>gem install dbd-mysql-0.4.4.gem --no-ri --no-rdoc --local
Successfully installed mysql-2.8.1-x86-mingw32
Successfully installed dbd-mysql-0.4.4
2 gems installed

実行結果
D:\Ruby192p290>cd D:\Apache2.2\htdocs\ruby_prg\em_ruby\em_db

D:\Apache2.2\htdocs\ruby_prg\em_ruby\em_db>ruby dbi_mysql_connect2.rb
D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/deprecated-2.0.1/lib/deprecated.rb:199: warning: already initialized constant Deprecate
#DBI::DatabaseHandle:0xb444d0
#DBI::StatementHandle:0xb441d0
D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

-- control frame ----------
c:0009 p:---- s:0035 b:0035 l:000034 d:000034 CFUNC :fetch_fields
c:0008 p:0093 s:0032 b:0032 l:000031 d:000031 METHOD D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130
c:0007 p:0040 s:0024 b:0024 l:000018 d:000023 BLOCK D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:37
c:0006 p:0019 s:0022 b:0022 l:000021 d:000021 METHOD internal:prelude:10
c:0005 p:0029 s:0019 b:0019 l:000018 d:000018 METHOD D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:34
c:0004 p:0096 s:0014 b:0014 l:000013 d:000013 METHOD D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/statement.rb:116
c:0003 p:0091 s:0010 b:0010 l:001f64 d:0024f4 EVAL dbi_mysql_connect2.rb:16
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001f64 d:001f64 TOP

-- Ruby level backtrace information ----------------------------------------
dbi_mysql_connect2.rb:16:in <main>' D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/statement.rb:116:in execute'
D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:34:in execute' <internal:prelude>:10:in synchronize'
D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:37:in block in execute' D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:in column_info'
D:/Ruby192p290/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:in `fetch_fields'

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

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

同様にRuby1.8.7p352でもエラーとなります。
Mysql関連設定及び実行結果
============ MySQL セットアップ ================================

※ libmysql.dll (サイズ 2028KB)⇒bin\にコピーする

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

=========== dbd-mysql-0.4.3 をセットする=====================
D:>cd ruby187p352

D:\Ruby187p352>cd dbd-mysql-0.4.3

D:\Ruby187p352\dbd-mysql-0.4.3>ruby setup.rb config
---> lib
---> lib/dbd
---> lib/dbd/mysql
<--- lib/dbd/mysql
<--- lib/dbd
<--- lib

D:\Ruby187p352\dbd-mysql-0.4.3>ruby setup.rb setup
---> lib
---> lib/dbd
---> lib/dbd/mysql
<--- lib/dbd/mysql
<--- lib/dbd
<--- lib

D:\Ruby187p352\dbd-mysql-0.4.3>ruby setup.rb install
rm -f InstalledFiles
---> lib
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8
---> lib/dbd
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbd
install Mysql.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbd
---> lib/dbd/mysql
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbd/mysql
install database.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbd/mysql
install driver.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbd/mysql
install statement.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbd/mysql
<--- lib/dbd/mysql
<--- lib/dbd
<--- lib

D:\Ruby187p352\dbd-mysql-0.4.3>

===================== dbd-mysql-0.4.3 をセットする ====================
D:\Ruby187p352\dbd-mysql-0.4.3>cd ..

D:\Ruby187p352>cd dbi-0.4.3

D:\Ruby187p352\dbi-0.4.3>ruby setup.rb config
---> bin
<--- bin
---> lib
---> lib/dbi
---> lib/dbi/base_classes
<--- lib/dbi/base_classes
---> lib/dbi/handles
<--- lib/dbi/handles
---> lib/dbi/sql
<--- lib/dbi/sql
---> lib/dbi/utils
<--- lib/dbi/utils
<--- lib/dbi
<--- lib

D:\Ruby187p352\dbi-0.4.3>ruby setup.rb setup
---> bin
updating shebang: dbi
updating shebang: test_broken_dbi
<--- bin
---> lib
---> lib/dbi
---> lib/dbi/base_classes
<--- lib/dbi/base_classes
---> lib/dbi/handles
<--- lib/dbi/handles
---> lib/dbi/sql
<--- lib/dbi/sql
---> lib/dbi/utils
<--- lib/dbi/utils
<--- lib/dbi
<--- lib

D:\Ruby187p352\dbi-0.4.3>ruby setup.rb install
rm -f InstalledFiles
---> bin
mkdir -p D:/Ruby187p352/bin
install dbi D:/Ruby187p352/bin/
install test_broken_dbi D:/Ruby187p352/bin/
<--- bin
---> lib
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8
install dbi.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/
---> lib/dbi
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install base_classes.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install binary.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install columninfo.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install exceptions.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install handles.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install row.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install sql.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install sql_type_constants.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install trace.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install types.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install typeutil.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
install utils.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi
---> lib/dbi/base_classes
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/base_classes
install database.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/base_classes
install driver.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/base_classes
install statement.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/base_classes
<--- lib/dbi/base_classes
---> lib/dbi/handles
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/handles
install database.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/handles
install driver.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/handles
install statement.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/handles
<--- lib/dbi/handles
---> lib/dbi/sql
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/sql
install preparedstatement.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/sql
<--- lib/dbi/sql
---> lib/dbi/utils
mkdir -p D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/utils
install date.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/utils
install tableformatter.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/utils
install time.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/utils
install timestamp.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/utils
install xmlformatter.rb D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi/utils
<--- lib/dbi/utils
<--- lib/dbi
<--- lib

D:\Ruby187p352\dbi-0.4.3>

========= MySQL関連のgemをインストールする =============================

D:\Ruby187p352\dbi-0.4.3>cd ..

D:\Ruby187p352>gem install deprecated-2.0.1.gem --no-ri --no-rdoc --local
Successfully installed deprecated-2.0.1
1 gem installed

D:\Ruby187p352>gem install mysql-2.8.1-x86-mswin32.gem --no-ri --no-rdoc --local
Successfully installed mysql-2.8.1-x86-mswin32
1 gem installed

D:\Ruby187p352>

+++++++++++++++++++++MySQLアクセス検証++エラー発生++++++++++++++++++++

D:>cd D:\Apache2.2\htdocs\ruby_prg\em_ruby\em_db

D:\Apache2.2\htdocs\ruby_prg\em_ruby\em_db>ruby dbi_mysql_connect2.rb
D:/Ruby187p352/lib/ruby/gems/1.8/gems/deprecated-2.0.1/lib/deprecated.rb:199: warning: already initialized constant Deprecate
D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi.rb:318:in load_driver': Could not load driver (Could not find driver Mysql or mysql (error: RubyGem version error: mysql(2.8.1 not >= 0) (DBI::InterfaceError) )) from D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi.rb:160:in _get_full_driver'
from D:/Ruby187p352/lib/ruby/site_ruby/1.8/dbi.rb:145:in `connect'
from dbi_mysql_connect2.rb:6

D:\Apache2.2\htdocs\ruby_prg\em_ruby\em_db>ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]

Updated by mrkn (Kenta Murata) over 12 years ago

  • Target version set to 1.9.2

dbi_mysql_connect2.rb は何者ですか?

Updated by sorah (Sorah Fukumori) over 12 years ago

  • Status changed from Open to Feedback

ping?

Updated by e_maekawa (eiichi maekawa) over 12 years ago

dbi_mysql_connect2.rbは、MySQLへアクセスする簡単なプログラムです。
コードは、以下です。

#!D:/Ruby/bin/ruby.exe -Ks

require "dbi"

begin
dbh = DBI.connect('DBI:Mysql:fbsys:'サーバ名', 'db名', 'PWD')
sth = dbh.prepare("SELECT * FROM テーブル名")
puts dbh
puts sth
sth.execute
puts 'count='+sth.rows.to_s

count = 0
sth.fetch { |row|
p row
count = count + 1
}
sth.finish
puts 'increment count='+count.to_s
#DB例外発生時の処理
rescue DBI::DatabaseError => e
p "An error occurred"
p "Error code: #{e.err}"
p "Error message: #{e.errstr}"
#切断漏れしないようにensureでdisconnectします。
ensure
dbh.disconnect if dbh
end

Updated by mame (Yusuke Endoh) over 11 years ago

  • Status changed from Feedback to Rejected

エラーメッセージで検索しただけで申し訳ないんですが、
新しいバージョンの mysql の libmysql.dll だと MySQL gem は動かない
ことがあるらしいです。

http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/368332?368278-370552+split-mode-vertical
http://fuyun.org/2010/01/ruby-mysql-adapter-on-windows/

トレースからみてきっとこれだと思いましたので、ご確認ください。
直らなかったらすみません、reopen してください。

--
Yusuke Endoh

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0