How to connect Sql Server Database from android app?

Is Ruby on Rails suitable for apps that need to connect to more than one database (i.e. more than one data source) or apps that are database independent (i.e. can work with PostgreSQL, SQL Server, Oracle, etc.)?

  • In my opinion while it is possible to build one Ruby on Rails app in which some models connect to DB1 and some to DB2 by monkey patching ActiveRecord and invoking establish_connection, RoR is not designed for suchlike use cases and another framework should be chosen for suchlike apps. Another question I've is if RoR is suitable for apps that need to connect both to a NoSQL (e.g. MongoDB) and relational database at the same time? Finally, as the query language of ActiveRecord is not 100% database agnostic (e.g. compared to Java Persistence API's JPQL and Hibernate's HQL), I think RoR is not suitable for apps that need to support different RDBMS types. What do you think? Are my assumptions and observations correct?

  • Answer:

    You should take a look at this gem https://github.com/tchandy/octopus, it allows you to connect to multiple databases, even with different adapters. I don't think you'll get any problems using AR and NoSQL gem like Mongoid at the same time, each model will inherit from the right class. I want to say that Rails is 100% database agnostic if you use AR right, but I can't be really sure because, in older versions of Rails I got some inconsistency between adapter but I think this has improved a lot in the last releases.

Igor Bozato at Quora Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.