如何在rails中迁移dbase数据库
如何将 rake 与 https://github.com/infused/dbf/ 一起使用。我尝试在database.yml中写入这样的文本:
development:
adapter: dbf
database: db/file.dbf
pool: 5
timeout: 5000
但它说,没有找到适配器activerecord-dbf-adapter。
我只需要读取 dbf 文件。
附言。我无法使用 JDBC 适配器。
更新
我想在rails中使用dbf数据库,例如另一个数据库(例如mysql),支持ActiveRecord
How to use rake with https://github.com/infused/dbf/. I tried to write in database.yml such text:
development:
adapter: dbf
database: db/file.dbf
pool: 5
timeout: 5000
But it say, that didn't find adapter activerecord-dbf-adapter.
I need only read dbf-files.
PS. I can't use JDBC adapter.
UPDATE
I want to use dbf database such as another dabases (e.g. mysql) in rails with support ActiveRecord
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您想将 dbf 与 ActiveRecord 一起使用,但这不是这个 gem 所做的。它只是提供从 Ruby 读取 dbf 文件的能力。
要在应用程序中使用它,您可以编写一个类来实现您想要的所有常用方法并从那里继承,例如:
如果您想将 dbf 与 ActiveRecord 一起使用,您应该为它找到一些适配器,但我还没有很幸运找到它。
I think you want to use dbf with ActiveRecord, but that it's not what this gem does. It just provides the ability to read dbf files from Ruby.
To use it in your application you could write a class that would implement all the common methods you want and inherit from there, something like:
If do you want to use dbf with ActiveRecord you should find some adapter for it, but I haven't been lucky looking for it.
https://github.com/infused/dbf/ 上有一章“基本用法”回答你的问题。
database.yml
是一个用于连接数据库的配置文件。如果您不想在整个 Rails 应用程序中连接到 dbf-db,则不得指定adapter: dbf
。这就是您收到此错误的原因。我强烈建议您阅读 http://guides.rubyonrails.org/getting_started.html。另请阅读 https://github.com/infused/dbf/ 上的 gem 的自述文件和 wiki。
There is a chapter "Basic usage" on https://github.com/infused/dbf/ that answers your question.
database.yml
is a config file to connect to databases. If you don't want to connect to a dbf-db throughout your whole rails application, you must not specifyadapter: dbf
. That's why you get this error.I strongly recommend you to read the guides on http://guides.rubyonrails.org/getting_started.html. Also read the gem's readme and wiki on https://github.com/infused/dbf/.