使用ruby的activerecord连接RDS for PPAS报错是什么原因-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

使用ruby的activerecord连接RDS for PPAS报错是什么原因

2015-12-18 16:26:42 1087 1

使用ruby的activerecord(版本4.1.1)连接RDS for PPAS报错,单连接本地的PG 9.3不报错。也可以通过Navicat连接RDS for PPAS成功。

错误信息:

ActiveRecord::Base.establish_connection(:dbname => 'postgres', :host => '121.199.103.187', :port => 3444,:user => 'xxx' , :password => 'xxx', :adapter => "postgresql")

class FirstLevelAsset < ActiveRecord::Base
end

irb(main):027:0> FirstLevelAsset.first
=> #

TypeError: no implicit conversion of String into Integer
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:769:in `[]'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:769:in `add_oid'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:777:in `add_oid'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:802:in `block in initialize_type_map'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:801:in `each'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:801:in `initialize_type_map'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:577:in `initialize'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `new'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:41:in `postgresql_connection'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `new_connection'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `checkout_new_connection'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `acquire_connection'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `block in checkout'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `checkout'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
... 25 levels...
from /usr/local/rvm/gems/ruby-2.1.4/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /usr/local/rvm/gems/ruby-2.1.4/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/commands/rails.rb:6:in `call'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/command_wrapper.rb:38:in `call'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application.rb:183:in `block in serve'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application.rb:156:in `fork'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application.rb:156:in `serve'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /usr/local/rvm/gems/ruby-2.1.4/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'

取消 提交回答
全部回答(1)
  • 明虚
    2019-07-16 11:49:53

    原因找到了,是activerecord版本的原因,使用activerecord 4.0.2或者4.2都没有问题。

    2 0
相关问答

17

回答

【大咖问答】对话PostgreSQL 中国社区发起人之一,阿里云数据库高级专家 德哥

阿里ACE 彭飞 2019-07-10 09:36:10 1033291浏览量 回答数 17

162

回答

惊喜翻倍:免费ECS+免费环境配置~!(ECS免费体验6个月活动3月31日结束)

豆妹 2014-10-29 17:52:21 226078浏览量 回答数 162

145

回答

【新手入门】云服务器linux使用手册

fanyue88888 2012-11-26 17:14:18 157651浏览量 回答数 145

8

回答

OceanBase 使用动画(持续更新)

mq4096 2019-02-20 17:16:36 336959浏览量 回答数 8

110

回答

OSS存储服务-客户端工具

newegg11 2012-05-17 15:37:18 295454浏览量 回答数 110

22

回答

爬虫数据管理【问答合集】

我是管理员 2018-08-10 16:37:41 147203浏览量 回答数 22

18

回答

阿里云开放端口权限

xcxx 2016-07-20 15:03:33 646702浏览量 回答数 18

38

回答

安全组详解,新手必看教程

我的中国 2017-11-30 15:23:46 259788浏览量 回答数 38

249

回答

阿里云LNAMP(Linux + Nginx + Apache + MySQL + PHP)环境一键安装脚本

云代维 2014-02-14 15:26:06 305577浏览量 回答数 249

2

回答

区域选择帮助

fanyue88888 2012-12-07 15:54:30 204365浏览量 回答数 2
+关注
明虚
PostgreSQL、Greenplum内核开发
11
文章
48
问答
问答排行榜
最热
最新
相关电子书
更多
《Nacos架构&原理》
立即下载
《看见新力量:二》电子书
立即下载
云上自动化运维(CloudOps)白皮书
立即下载