Giter VIP home page Giter VIP logo

ar-sybase-jdbc-adapter's People

Contributors

arkadiyk avatar buruzaemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ar-sybase-jdbc-adapter's Issues

Cannot get the adapter to work

Hi,

Kudos for the effort to make Rails and ActiveRecord talk to the Sybase database.

I know that this project is already abandoned and probably there won't be any attention paid to this discussion at all, but still I would like to take my shot.

I am trying to make a very simple Rails application work with the Sybase adapter. I am using a relatively old Rails - version 2.3.11, and the latest Sybase ASE 15.7, and I am stuck at the db:migrate execution: I get this error

rake aborted!
uninitialized constant ActiveRecord::ConnectionAdapters::SybaseJdbcConnection

Could you please elaborate with which versions of the Rails framework, and the 'parent' ActiveRecord-JDBC Adapter is the Sybase adapter compatible with ? It seems that when using other version of the AR-JDBC adapter than 1.1.3, I get

Unable to activate ar-sybase-jdbc-adapter-0.2.2, because activerecord-jdbc-adapter-1.2.2.1 conflicts with activerecord-jdbc-adapter (~> 1.1.1)

But the 1.1.3 version itself yields the other problem.

Cheers,
Krum.

https://www.savethekoala.com/

Catalog procedure 'sp_pkeys' can not be run in a transaction

I'm trying to setup JRuby on Rails work with Sybase using ar-sybase-jdbc-adapter & activerecord-jdbc-adapter, it shows the existing data in table properly, but if I try to add/edit/delete any data, it throws the following error. The table has a primary key column which is not called as 'id', but I modified the model to specify the primary key -

ActiveRecord::JDBCError (Catalog procedure 'sp_pkeys' can not be run in a transaction.):
arjdbc/jdbc/RubyJdbcConnection.java:121:in columns' activerecord-jdbc-adapter (1.1.3) lib/arjdbc/jdbc/adapter.rb:227:injdbc_columns'
arel (2.0.10) lib/arel/table.rb:97:in columns' arel (2.0.10) lib/arel/table.rb:104:in[]'
activerecord (3.0.8) lib/active_record/base.rb:1727:in arel_attributes_values' org/jruby/RubyArray.java:1615:ineach'
activerecord (3.0.8) lib/active_record/base.rb:1718:in arel_attributes_values' activerecord (3.0.8) lib/active_record/persistence.rb:269:increate'
activerecord (3.0.8) lib/active_record/timestamp.rb:47:in create' activerecord (3.0.8) lib/active_record/callbacks.rb:277:increate'
activesupport (3.0.8) lib/active_support/callbacks.rb:429:in _run_create_callbacks' activerecord (3.0.8) lib/active_record/callbacks.rb:277:increate'
activerecord (3.0.8) lib/active_record/persistence.rb:250:in create_or_update' activerecord (3.0.8) lib/active_record/callbacks.rb:273:increate_or_update'
activesupport (3.0.8) lib/active_support/callbacks.rb:429:in _run_save_callbacks' activerecord (3.0.8) lib/active_record/callbacks.rb:273:increate_or_update'
activerecord (3.0.8) lib/active_record/persistence.rb:40:in save' activerecord (3.0.8) lib/active_record/validations.rb:43:insave'
activerecord (3.0.8) lib/active_record/attribute_methods/dirty.rb:21:in save' activerecord (3.0.8) lib/active_record/transactions.rb:240:insave'
activerecord (3.0.8) lib/active_record/transactions.rb:292:in with_transaction_returning_status' activerecord (3.0.8) lib/active_record/connection_adapters/abstract/database_statements.rb:139:intransaction'

[Consultation] How to verify that the adapter is really being used ?

Hi Arkadiy,

I would like to ask you a consulting question about the Sybase adapter, no particular bug is being observed.

I managed to rewrite my small Rails 2 application to be Rails 3 - based, and luckily those Arel-based issues are gone indeed.

I had some difficulties with setting up my landscape, so for the sake of sharing my experience, I will just list them briefly:

  • The 'ar-sybase-jdbc-adapter' gem drags along the 'jdbc-jtds' gem, but its (current) latest version - 1.3.0 - causes some problems when your landscape is based on Java 6 + JRuby: some strange java versions incompatibility occurs. Probably that version of the gem brings a jar which is compiled with Java 7. That's why I had to use version 1.2.5 instead, which worked fine.
  • In order to avoid some class-not-found-alike problems, you have to require explicitly the 'jdbc-jtds' gem, and even the jar that is bundled inside. Since I am relatively new to Rails, it took me some time to figure out where to put those require statements. Using config/environment.rb worked for me.
  • Setting up the config/database.yml again was not completely trivial: it turned out that the 'url' property needs a fully specified host, which in the case when you use a local Sybase ASE installation, means that 'localhost' is not an option, and the full DNS name is needed (127.0.0.1 did not work too). This I found after some googling.

Okay, and thus I was able to connect to the Sybase ASE database. When I executed 'rake db:migrate' I got an ActiveRecord::JDBCError because the SQL statement produced was obviously wrong for Sybase. What puzzles me here is the output I got when I reexecuted the task with the '--trace' option: the stacktrace shown did not contain any traces from using the 'ar-sybase-jdbc-adapter' gem. All the files that were shown were either in the ActiveRecord framework, or in the activerecord-jdbc-adapter gem. I guess that because of some reason the Sybase adapter didn't get called ? Shouldn't 'db:migrate' go through the Sybase adapter ?

What's even more strange is the use of the 'mssql' adapter:

arjdbc/jdbc/RubyJdbcConnection.java:321:in execute_update' c:/jruby-1.7.2/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.2.5/lib/arjdbc/mssql/adapter.rb:386:in_execute'
c:/jruby-1.7.2/lib/ruby/gems/shared/gems/activerecord-jdbc-adapter-1.2.5/lib/arjdbc/jdbc/adapter.rb:209:in execute' c:/jruby-1.7.2/lib/ruby/gems/shared/gems/activerecord-3.2.10/lib/active_record/connection_adapters/abstract_adapter.rb:280:inlog'

Could you please give some hint/advise here ? Why does the workflow go through the mssql adapter, and not through the Sybase one ? Indeed, database.yml contains the 'adapter: jdbc' line, which additionally puzzles me - shouldn't the adapter be loaded by its own dedicated name, like the other ones ? I see that it uses some different mechanism instead - by specifying a 'dialect' property and using some generic jTds driver. The 'Sybase native JDBC' driver 'com.sybase.jdbc4.jdbc.SybDriver' which comes with the sample Java snippets of the Sybase ASE installation, is never used.

I just found the following, inside 'C:\jruby-1.7.2\lib\ruby\gems\shared\gems\ar-sybase-jdbc-adapter-0.2.0\lib\arjdbc\sybase_jtds.rb':

def supports_migrations?
false
end

Does that mean that the Sybase adapter does not support migrations ?

Thanks and Kindest Regards,
Krum.

https://www.savethekoala.com/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.