2016-06-16 6 views
0

읽기 전용 쿼리를 실행하기 위해 Ruby 프로그램에 MS SQL 데이터베이스를 연결하려고합니다. 나는 Sequel, Ruby-DBI, TinyTDS를 사용하지 않으려 고 노력했다.MS SQL 데이터베이스를 Ruby에 연결하는 방법

이 속편를 연결하기위한 내 코드입니다

다음에

 @db = Sequel.tinytds(
     :host  => options['dbserver'], 
     :database=> options['db'],  
     :user  => options['dbuser'], 
     :password=> options['dbpwd'], 
     #:timeout => options['timeout'], #for long lasting requests 
    )    

: 내가 함께 tinytds를 사용

C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
: LoadError: cannot load such file -- sequel/adapters/ (Sequel::AdapterNotFound) 

     from C:/Ruby22-x64/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require' 
     from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sequel-4.35.0/lib/sequel/database/connecting.rb:98:in `load_adapter' 
     from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sequel-4.35.0/lib/sequel/database/connecting.rb:28:in `adapter_class' 
     from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sequel-4.35.0/lib/sequel/database/connecting.rb:56:in `connect' 
     from C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/sequel-4.35.0/lib/sequel/core.rb:108:in `connect' 
     from snippet.rb:11:in `<main>' 

답변

0

: 여기

require 'rubygems' 
require 'sequel' 

hostname = 'DB name' 
username = 'username here' 
password = 'password here' 
port = 1433 

connection_instance = Sequel.connect(:host => hostname, :user => username, :password => password, :test => true) 

은 내가 받고있어 오류입니다 과거에 나는 입김을 사용 했었지만, 입맛에 문제가있었습니다 (인코딩 오류, 시간 초과 ...)

관련 문제