gpt4 book ai didi

ruby-on-rails - tiny_tds : Segmentation fault

转载 作者:行者123 更新时间:2023-12-02 03:34:45 26 4
gpt4 key购买 nike

这与此类似 question .然而,answer发布在那个问题上,对我不起作用。我已经在我的 Mac 上安装了 freetds。我在 GemFile 中指定了以下内容。

gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter', '~> 4.1.0'

我可以连接到 Azure SQL 成功 使用以下,
tsql -H host_name.database.windows.net -U user_name -D database_name -p 1433 -P password

我也可以连接到 Azure SQL 成功 在 irb。
require 'tiny_tds'
client = TinyTds::Client.new(:username => 'user_name@host_name', :password => 'password', :host =>'host_name.database.windows.net')

但是当我运行时,
rake 数据库:迁移
我收到以下错误,
[BUG] Segmentation fault at 0x007fff5f3ffff8
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]

接着是,
Control frame information
C level backtrace information
Other runtime information

最后,以,
[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

Abort trap: 6

任何人都可以分享任何想法或建议吗?

更新:我的 Database.yml 看起来像,
development:
#adapter: sqlite3
#database: db/development.sqlite3
#pool: 5
#timeout: 5000
adapter: sqlserver
mode: dblib
dataserver:
host: host_name.database.windows.net
port: 1433
database: database_name
username: user_name
password: password
timeout: 5000
azure: true

我在 IRB 上运行了以下内容,
2.1.1 :028 > ActiveRecord::Base.establish_connection(
2.1.1 :029 > :adapter => "sqlserver",
2.1.1 :030 > :host => "host_name.database.windows.net",
2.1.1 :031 > :username => "user_name",
2.1.1 :032 > :password => "password",
2.1.1 :033 > :database => "database_name"
2.1.1 :034?> )

并得到以下回应,
 => #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x00000101e8c798 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000101e8c748>, @spec=#<ActiveRecord::ConnectionAdapters::ConnectionSpecification:0x00000101f3ceb8 @config={:adapter=>"sqlserver", :host=>"host_name.database.windows.net", :username=>"user_name", :password=>"password", :database=>"database_name"}, @adapter_method="sqlserver_connection">, @checkout_timeout=5, @dead_connection_timeout=5, @reaper=#<ActiveRecord::ConnectionAdapters::ConnectionPool::Reaper:0x00000101e8c720 @pool=#<ActiveRecord::ConnectionAdapters::ConnectionPool:0x00000101e8c798 ...>, @frequency=nil>, @size=5, @reserved_connections=#<ThreadSafe::Cache:0x00000101e8c6d0 @backend={}, @default_proc=nil>, @connections=[], @automatic_reconnect=true, @available=#<ActiveRecord::ConnectionAdapters::ConnectionPool::Queue:0x00000101e8c658 @lock=#<ActiveRecord::ConnectionAdapters::ConnectionPool:0x00000101e8c798 ...>, @cond=#<MonitorMixin::ConditionVariable:0x00000101e8c630 @monitor=#<ActiveRecord::ConnectionAdapters::ConnectionPool:0x00000101e8c798 ...>, @cond=#<Thread::ConditionVariable:0x00000101e8c608>>, @num_waiting=0, @queue=[]>> 

最佳答案

我会简化您的 database.yml 配置,精简为基本要素。

development:
adapter: sqlserver
host: "host.database.windows.net"
port: 1433
database: <database>
username: <username>
password: <password>
timeout: 5000

但首先尝试模拟通过 IRB 中的 db:migrate 任务发生的连接实例。
 ActiveRecord::Base.establish_connection(
:adapter => "sqlserver",
:host => "host.database.windows.net",
:username => <username>,
:password => <password>,
:database => <database>
)

如果成功,则只使用 database.yml 中的那些值。如果您需要添加更多配置值,请一次添加一个。尽管这些核心配置应该可以完成这项工作。

关于ruby-on-rails - tiny_tds : Segmentation fault,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24354399/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com