[jruby] Issues running AR-JDBC against Oracle 12c

Ricky Ng dummey at gmail.com
Thu Jul 23 01:04:04 JST 2015


Can you post the schema of the table you are trying to insert to? My guess
in the dark is that your table is missing a primary key column which
ActiveRecord uses to uniquely link your AR object and the row in the table.

On Wed, Jul 22, 2015 at 7:02 AM, Ewan Slater <ewan.slater at gmail.com> wrote:

> Hi,
>
> As per Uwe's advice (see below), I amended the gemfile as follows.:
>
> # original:
> #gem 'activerecord-jdbc-adapter'
>
> # Uwe's suggestion:
> gem 'activerecord-jdbc-adapter', :github =>
> 'jruby/activerecord-jdbc-adapter', branch:'1-3-stable'
>
> The good news is that this worked and I now have the tables created in
> the Oracle DB.
>
> The bad news is that when the app tried to make the first insert into
> the DB, there was an error:
>
> I, [2015-07-22T11:51:00.854000 #2149]  INFO -- : Started POST
> "/articles" for 84.92.156.207 at 2015-07-22 11:51:00 +0000
> I, [2015-07-22T11:51:00.971000 #2149]  INFO -- : Processing by
> ArticlesController#create as HTML
> I, [2015-07-22T11:51:00.995000 #2149]  INFO -- :   Parameters:
> {"utf8"=>"✓",
> "authenticity_token"=>"v9o7dMHHPnboeUl1+JHbf4lwq4TuC3NLE9hasZNYY/9Z28MzncN2rYKiQyEh/pLx7rxYkEOU4lvYxgn/w/V/9g==",
> "article"=>{"title"=>"First on DB", "text"=>"The first article created
> on the DB."}, "commit"=>"Create Article"}
> I, [2015-07-22T11:51:02.161000 #2149]  INFO -- : Completed 500
> Internal Server Error in 1165ms (ActiveRecord: 0.0ms)
> F, [2015-07-22T11:51:02.177000 #2149] FATAL -- :
> NoMethodError (undefined method `primary' for
> #<ActiveRecord::ConnectionAdapters::OracleColumn:0x5a10836b>):
>   app/controllers/articles_controller.rb:20:in `create'
>
> Any suggestions as to how I might resolve this latest issue (I changed
> the title of my original post since I suspect I may have a bunch of
> issues to work through here)?
>
> Cheers,
>
> Ewan
>
> > Message: 2
> > Date: Sat, 18 Jul 2015 23:54:35 +0200
> > From: Uwe Kubosch <donv42 at gmail.com>
> > To: Mailing list for the JRuby project <jruby at ruby-lang.org>
> > Subject: Re: [jruby] Cannot run rake db:migrate with AR-JDBC against
> >         Oracle  12c
> > Message-ID: <AADC6174-0A2B-4BA0-8AA0-7E8AA8C9F53C at kubosch.no>
> > Content-Type: text/plain; charset=utf-8
> >
> > Hi Ewan!
> >
> > You are using ActiveRecord 4.2.x, right?
> >
> > This has been fixed for most ARJDBC adapters, and I would love to get a
> confirmation for Oracle.
> >
> > Please try the 1-3-stable branch with your setup.
> >
> > Gemfile:
> >
> >    gem ?activerecord-jdbc-adapter?, github:
> ?jruby/activerecord-jdbc-adapter?, branch: ?1-3-stable'
> >
> > You are using ?jdbc-jtds??
> >
> >
> > ***********************************
>



-- 
Incoherently,
Ricky Ng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ruby-lang.org/pipermail/jruby/attachments/20150722/0065e84b/attachment.html>


More information about the JRuby mailing list