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

开发者社区> 问答> 正文

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

2015-12-18 16:26:42 1281 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
相关问答

1

回答

spring中为什么要使用静态代理啊?

2022-04-04 08:36:46 247浏览量 回答数 1

2

回答

spring中为什么要使用静态代理啊?

2022-04-03 23:54:17 1315浏览量 回答数 2

0

回答

对于入口流量管理,为什么不直接使用 Kubernetes Ingress API?

2021-12-03 09:37:01 189浏览量 回答数 0

1

回答

mvn source:jar-no-fork的作用是什么?

2021-10-27 21:46:16 127浏览量 回答数 1

1

回答

使用jquery.form提交含有file的表单?报错

2020-06-09 10:36:12 306浏览量 回答数 1

1

回答

SpringCloud从本地注册到EDAS,本地可以正常使用RestTemplate访问,EDAS控制台的服务查询看不到注册的服务

2018-08-23 10:48:22 2287浏览量 回答数 1

2

回答

SpringCloud从本地注册到EDAS,本地可以正常使用RestTemplate访问,EDAS控制台的服务查询看不到注册的服务

2018-08-23 10:37:30 2665浏览量 回答数 2

1

回答

js同时加载了很多个form表单到页面,如何让这些表单都能用jquery的ajaxForm提交呢?

2016-07-06 09:30:09 2280浏览量 回答数 1

1

回答

能否只用activerecord,其它的还是使用struts2,spring。

2016-06-08 09:24:55 1476浏览量 回答数 1

1

回答

关于Db+ActiveRecord

2016-06-08 11:02:53 1664浏览量 回答数 1
+关注
明虚
PostgreSQL、Greenplum内核开发
11
文章
48
问答
问答排行榜
最热
最新
相关电子书
更多
低代码开发师(初级)实战教程
立即下载
阿里巴巴DevOps 最佳实践手册
立即下载
冬季实战营第三期:MySQL数据库进阶实战
立即下载