Hello Stackoverflow成员,
我需要从外部数据库导入数据,这是一个天蓝色的数据库。我收到以下错误:TinyTds ::错误:不支持在数据库之间切换USE语句。使用新连接连接到其他数据库。
class Exact
require 'tiny_tds'
def connect
dbadmin = ""
password = "!"
server = ""
database = ""
a = true
client=TinyTds::Client.new(:username=>'', :password=> password, :dataserver=> server , :port=>1433, :database=>database, :azure=> 'true')
puts "connecting"
results = client.execute("select * from table")
puts "results opgehaald"
puts results.first
client.close
puts "client is closed"
end
end
我想我需要打开一个新的连接来连接到数据库,但我遇到了解决这个问题的问题。任何人都可以指出我正确的方向或协助我解决我遇到的问题。
亲切的问候,
Yoeri Huitema
答案 0 :(得分:0)
我修复了此主题中描述的问题:https://github.com/rails-sqlserver/tiny_tds/issues/249
client = TinyTds :: Client.new(:username =>'',:password => password,:dataserver => server,:port => 1433,:database = >数据库,:azure =>' true')
应该是
client = TinyTds :: Client.new(:username =>'',:password => password,:dataserver => server,:port => 1433,:database = >数据库,:azure => TRUE )