我正在尝试使用 gem dbi 或 sqlanywhere gem 来访问 Windows 64 位机器上的 SQLAnywhere 12 数据库。数据库在本地运行。我完全没有成功,任何帮助将不胜感激。
Ruby Version = ruby 1.9.3p385 (2013-02-06) [i386-mingw32]
*** LOCAL GEMS ***
bigdecimal (1.1.0)
builder (3.2.0)
childprocess (0.3.9)
chunky_png (1.2.7)
commonwatir (4.0.0)
compass (0.12.2)
dbd-odbc (0.2.5)
dbd-sqlanywhere (1.0.1)
dbi (0.4.5)
deprecated (2.0.1)
epoxy (0.3.1)
ffi (1.4.0 x86-mingw32)
fssm (0.2.10)
hoe (3.5.1)
io-console (0.3)
json (1.5.4)
libxml-ruby (2.6.0 x86-mingw32)
methlab (0.1.0)
mini_magick (3.2.1)
minitest (2.5.1)
multi_json (1.6.1)
nokogiri (1.5.6 x86-mingw32)
rake (0.9.2.2)
rautomation (0.7.3)
rdbi (0.9.1)
rdoc (3.9.5)
rubygems-update (2.0.1)
rubyzip (0.9.9)
s4t-utils (1.0.4)
sass (3.2.7)
selenium-webdriver (2.31.0)
sequel (3.46.0)
sqlanywhere (0.1.6 x86-mingw32)
subexec (0.0.4)
typelib (0.1.0)
user-choices (1.1.6.1)
watir (4.0.2 x86-mingw32)
watir-classic (3.4.0)
watir-webdriver (0.6.2)
websocket (1.0.7)
win32-api (1.4.8 x86-mingw32)
win32-process (0.7.1)
win32screenshot (1.0.7)
windows-api (0.4.2)
windows-pr (1.2.2)
xml-simple (1.1.2)
使用 DBI 时
require 'rubygems'
require 'dbi'
DBI.connect('DBI:ODBC:Agency')
返回
C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver': Unable to load driver 'ODBC' (underlying error: uninitialized constant DBI::DBD::ODBC) (DBI::InterfaceError)
from C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
from dbi_test.rb:4:in `<main>'
使用 sqlanywhere 时
require 'sqlanywhere'
api = SQLAnywhere::SQLAnywhereInterface.new()
SQLAnywhere::API.sqlany_initialize_interface( api )
api.sqlany_init()
sqlanywhere_test.rb:65: [BUG] Segmentation fault
ruby 1.9.3p385 (2013-02-06) [i386-mingw32]
-- Control frame information -----------------------------------------------
c:0027 p:---- s:0109 b:0109 l:000108 d:000108 CFUNC :sqlany_init
c:0026 p:0011 s:0106 b:0106 l:000093 d:000105 BLOCK sqlanywhere_test.rb:65
c:0025 p:0080 s:0104 b:0104 l:000103 d:000103 METHOD C:/Ruby193/lib/ruby/1.9.1/test/unit/assertions.rb:96
c:0024 p:0054 s:0094 b:0094 l:000093 d:000093 METHOD sqlanywhere_test.rb:64
c:0023 p:0046 s:0090 b:0090 l:000089 d:000089 METHOD C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:947
c:0022 p:0025 s:0084 b:0084 l:000083 d:000083 METHOD C:/Ruby193/lib/ruby/1.9.1/test/unit/testcase.rb:17
c:0021 p:0090 s:0080 b:0080 l:000068 d:000079 BLOCK C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:787
c:0020 p:---- s:0074 b:0074 l:000073 d:000073 FINISH
c:0019 p:---- s:0072 b:0072 l:000071 d:000071 CFUNC :map
c:0018 p:0124 s:0069 b:0069 l:000068 d:000068 METHOD C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:780
c:0017 p:0020 s:0061 b:0060 l:000050 d:000059 BLOCK C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:565
c:0016 p:---- s:0056 b:0056 l:000055 d:000055 FINISH
c:0015 p:---- s:0054 b:0054 l:000053 d:000053 CFUNC :each
c:0014 p:0053 s:0051 b:0051 l:000050 d:000050 METHOD C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:563
c:0013 p:0189 s:0045 b:0045 l:000044 d:000044 METHOD C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:746
c:0012 p:0013 s:0035 b:0035 l:000034 d:000034 METHOD C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:909
c:0011 p:0012 s:0032 b:0032 l:000023 d:000031 BLOCK C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:896
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 FINISH
c:0009 p:---- s:0027 b:0027 l:000026 d:000026 CFUNC :each
c:0008 p:0068 s:0024 b:0024 l:000023 d:000023 METHOD C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:895
c:0007 p:0029 s:0020 b:0020 l:000019 d:000019 METHOD C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:884
c:0006 p:0022 s:0016 b:0016 l:000015 d:000015 METHOD C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:21
c:0005 p:0033 s:0012 b:0011 l:000c44 d:000010 BLOCK C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:326
c:0004 p:0036 s:0009 b:0009 l:000008 d:000008 METHOD C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:27
c:0003 p:0026 s:0006 b:0006 l:000c44 d:000005 BLOCK C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:325
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001d0c d:001d0c TOP
-- Ruby level backtrace information ----------------------------------------
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:21:in `run'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:895:in `_run'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:895:in `each'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:896:in `block in _run'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:909:in `run_tests'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:746:in `_run_anything'
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:563:in `_run_suites'
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:563:in `each'
C:/Ruby193/lib/ruby/1.9.1/test/unit.rb:565:in `block in _run_suites'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:780:in `_run_suite'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:780:in `map'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:787:in `block in _run_suite'
C:/Ruby193/lib/ruby/1.9.1/test/unit/testcase.rb:17:in `run'
C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb:947:in `run'
sqlanywhere_test.rb:64:in `setup'
C:/Ruby193/lib/ruby/1.9.1/test/unit/assertions.rb:96:in `assert_nothing_raised'
sqlanywhere_test.rb:65:in `block in setup'
sqlanywhere_test.rb:65:in `sqlany_init'
-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(ZwWaitForSingleObject+0x15) [0x77aaf8b1]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x75771194]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x75771148]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_vm_bugreport+0xf9) [0x62e5c69d]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_name_err_mesg_new+0x17a) [0x62d3a856]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_bug+0x2f) [0x62d3b533]
C:\Ruby193\bin\msvcrt-ruby191.dll(rb_check_safe_str+0x1a4) [0x62dee738]
[0x004011e6]
C:\Windows\syswow64\kernel32.dll(GetProfileStringW+0x12aa3) [0x757b003f]
C:\Windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x77b074df]
-- Other runtime information -----------------------------------------------
* Loaded script: sqlanywhere_test.rb
* Loaded features:
0 enumerator.so
1 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so
2 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/iso_8859_1.so
3 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so
4 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb
5 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/compatibility.rb
6 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
7 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
8 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/errors.rb
9 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/version.rb
10 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb
11 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/platform.rb
12 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb
13 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
14 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb
15 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb
16 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb
17 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems.rb
18 C:/Ruby193/lib/ruby/site_ruby/1.9.1/ubygems.rb
19 C:/Ruby193/lib/ruby/1.9.1/optparse.rb
20 C:/Ruby193/lib/ruby/1.9.1/minitest/unit.rb
21 C:/Ruby193/lib/ruby/1.9.1/prettyprint.rb
22 C:/Ruby193/lib/ruby/1.9.1/pp.rb
23 C:/Ruby193/lib/ruby/1.9.1/test/unit/assertions.rb
24 C:/Ruby193/lib/ruby/1.9.1/test/unit/testcase.rb
25 C:/Ruby193/lib/ruby/1.9.1/test/unit.rb
26 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/date_core.so
27 C:/Ruby193/lib/ruby/1.9.1/date/format.rb
28 C:/Ruby193/lib/ruby/1.9.1/date.rb
29 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/path_support.rb
30 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/utf_16le.so
31 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/utf_16_32.so
32 C:/Ruby193/lib/ruby/1.9.1/i386-mingw32/enc/trans/single_byte.so
33 C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb
34 C:/Ruby193/lib/ruby/gems/1.9.1/gems/sqlanywhere-0.1.6-x86-mingw32/lib/sqlanywhere.so
[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.
>Exit code: 3