require 'rubygems'
require 'jdbc/jtds'
require 'activerecord-jdbc-adapter'
config = {
:username => 'me',
:password => 'mypass',
:adapter => 'jdbc',
:driver => 'net.sourceforge.jtds.jdbc.Driver',
:url => 'jdbc:jtds:sybase://myserver:1234/mydb'
}
ActiveRecord::Base.establish_connection( config )
ActiveRecord::Base.connection.class
# => ActiveRecord::ConnectionAdapters::MssqlJdbcConnection
我意识到MSSQL和Sybase有共享历史记录,但在连接到Sybase时我得到此适配器是否正确?
我的问题是类型没有正确映射到ruby类型。例如浮点数,小数被转换为字符串。
宝石:
答案 0 :(得分:0)
ActiveRecord将通过添加
来解析JDBC适配器:dialect => 'sybase'
...配置选项