As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Is it architecturally sound to use Rails and Oracle?
My concern is that Oracle would be too "heavy and hi-end" for Rails.
Any thoughts?
Thanks.
The database needs of Rails more or less boil down to tables, indices and CRUD.
Anything that provides those ought to be able to serve as the back-end to a Rails app, and Oracle certainly does those parts somewhere among the bloat vast range of features it provides. If you can use ActiveRecord migrations then you shouldn't need to worry too much about platform-specific aspects anyway.
The oracle-adapter for ActiveRecord (which needs to be downloaded separately and placed in activerecord\lib\active_record\connection_adapters, btw) makes use of Oracle-specific elements where appropriate, the main one I can think of being the use of sequences for id generation.
The Oracle query optimiser is very smart, probably rather better for complex multi-table queries than, say, MySQL.
If you're looking at Oracle as a back-end for an externally-hosted site, then I'd be sceptical on cost grounds, as well as the reservation already stated about availability. But I suspect that the question relates more to what's already available in-house, in which case I'd say it's about as "good" a solution as you can get.
I'm developing intranet applications on Rails/Oracle, using OracleXE locally for development, deploying to some "big iron" machine (it's someone else's job to care for it, I don't even know what OS it's running) for production.
EDIT: It's worth looking at the activerecord-oracle_enhanced-adapter (it's a gem) as a replacement for the built-in oracle adapter, if only for the improved handling of date/datetime values (Oracle only has one column type for both: DATE). It's probably saved me from a breakdown...
Why too heavy? Oracle it's just a database that can be simple to heavy depending on your use. Today Oracle have a lot of editions to accomodate any use, for instance the little one Oracle XE.
If your are happy with Oracle, use it. Don't worry.
The problem that you may suffer when using Oracle as Database is you can't find many hosting companies offering oracle as choice for your database on web.
also oracle like a giant DB, if you don't need the specific features in it, why use it?
Another thing to consider regarding Oracle and Rails: none of the full text searching plug-ins for Rails support Oracle at this time. Indeed, pretty much only MySQL and PostgreSQL are well-supported by the various full-text options.
This is not to say you won't be able to do full-text searching if you use Oracle, just that you will not be able to use any of the existing plug-ins that make doing so simple.
I'm currently using Oracle with some Rails applications. There are both standard ActiveRecord and JDBC-ActiveRecord adapters (I'm hosting some apps with JRuby) and for the most part, things work great.
I would suggest using the enhanced ActiveRecord Oracle adapter though.
http://rubyforge.org/projects/oracle-enhanced/
But if you're not locked into Oracle, go with Postgres or MySQL.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I like to experiment with different languages to keep my interest alive when working on small side projects away from my day job.
I'm finding it increasingly difficult to steer away from Django and Ruby on Rails because of a couple of features they come packed with (or that are mostly default and easily integrated): authentication and automatic admin interface. Django comes with both, with Rails you just have to add ActiveAdmin as a gem and you're ready to go.
When I try to experiment with different frameworks and languages (Noir for Clojure, Express for Node), most of the times I find interesting languages I'd love to work with but whose "web framework" idea is just some convenience method for routing and parsing URLs and requests, leaving you alone with all the common and annoying parts of web development, like form validation, user authentication and profiling, having a working admin interface and so on, all things that Django and RoR provide to you for free.
What other languages and frameworks have such commodities? I'm aware of some PHP frameworks like Symfony, but I really have used PHP for too long in pas years and I'm pretty fed of it. Thanks.
Stick with RoR in my opinion. It's still a young yet powerful framework. It's well maintained and quickly plugged whenever a security risk becomes known.
It doesn't really matter what kind of MVC framework you use since it all comes down to the programmer. Ruby on Rails cuts out the painful part of programming (IMO) and allows you to do the enjoyable parts. Requiring knowledge of SQL is very minimal within Rails unless you're doing complicated scoping.
If I kept searching around for different languages to explore after I found one that suited all of my needs and then some, I would never get anything done. Moving from PHP/CakePHP to Rails is definitely an upgrade in my opinion, but at this point, you're better off committing to one language (Python/Django or Ruby/Rails).
I would stick with Django. Having worked in everything from classic ASP, ASP.NET, ASP.NET MVC, Java, PHP and Rails, I can state, unequivocally that Django is hands-down the easiest to work with, most profitable framework I've ever used.
Rails does have some pretty controllers, but it pales in comparison when you get down to functionality. Sure, Rails has lots of plugins, but Django has nearly everything you need under one roof. Django-admin alone is a friggin' gold mine. I work full-time as a Technical Architect, but also own my own business. Switching from Rails to Django in 2008 was the single best thing I ever did for my business.
If you want something flexible, modular, easy-to-extend and incredibly well documented - Django is your ticket. You also see far, far fewer of these lovely posts with Django.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I have been learning Rails since this summer and have written some successful standalone apps with it, and really have grown to appreciate nearly everything about Rails.
However, my current project is writing Rails as a front-end to a database that will be used for other things (web services, data warehouses, other apps connecting) -- and I am realizing that ActiveRecord, and largely all the Rails developed around AR, seem to be very one directional when it comes to this approach.
Note: I am not referring to a Legacy database, ie. one that we have to plug into, but was designed "back in the day"..
Rails seems to think it is, and should be, the only application working with this data. I am noticing it more and more when it comes to things like, composite primary keys (which is something you cannot just adjust, like table naming and column naming).
While I know there is a composite key gem, I feel like I am developing an entire MVC application dependent on this single gem working. I fear I will run into more and more things like that. I have looked into alternative ORM's, however it seems that many gems depend on ActiveRecord.
I guess I am a bit surprised and saddened at this apparently selfish angle that ActiveRecord has.
Anyone have any feedback or success about how Rails works with an enterprise level database?
Rails is built primarily as an "opinionated" web development framework.
What it is built to do out-of-the-box is full-stack web applications, where the entire system is built the "Rails way", which is the result of many decisions made by committers to Rails to keep the system simple and standard. The number of configuration decisions that need to be made are very small when you stick to the conventions.
These conventions include setting up your databases in a certain way. Primary keys are auto-increment and named 'id', foreign keys are 'foreigntable_id'. ActiveRecord is built-in and almost always assumed to be used (even when it isn't).
None of this means that straying from the standard stack won't work. Sequel and DataMapper work just fine. You can name your table columns (nearly) anything you want. If your application can do what it is supposed to do; that is the most important thing.
Yes, because you used Datamapper, now your app depends on Datamapper. How is that a bad thing?
Understand that because ActiveRecord is the default, that many other gems build on ActiveRecord to do their thing, so they may not work with Datamapper. That is not Datamapper's fault (or Rails').
The real question here, is "Is Rails, even when you use an alternative ORM or the composite keys gem, still more suitable and productive than X?"
I would argue that it is. So what that I have to set self.table_name= and self.primary_key= in every class? So what if I have to be forgo some gems that only work with ActiveRecord? So what if you have to consider database triggers and views. I deal with all these things, and Rails is still a joy to work with compared to everything else I've ever used.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
There is a big concern regarding a recently-disclosed Rails SQL injection vulnerability. I am not well-versed in dealing with security, so I am unnerved. I hear that MongoDB is not susceptible to this kind of attack.
Is this a good reason to move to MongoDB permanently?
No. Just because SQL databases are vulnerable to SQL injection attacks is not a good reason to move to MongoDB.
MongoDB is great in certain use-cases, particularly where you need schema-less collections.
If you need to store relational data, you'll be much better served by a relational DB.
In short, if you're afraid of SQL injection, learn how to sanitize your inputs. Don't move to MongoDB.
The newly found vulnerability does not affect everyone. Read here for more details.
SQL != NoSQL
A relational database using SQL is not a feature-by-feature replacement for NoSQL. Depending on your problem domain, you can sometimes make different architectural or design decisions that favor one over the other, but you can't simply swap them out like spare parts because they have very different design goals and performance characteristics.
All Software Has Risks
Software security is a big topic, and well outside the scope of an SO question. However, switching from a product that is widely used and quickly patched to a product that you don't understand is not inherently a good risk management trade-off.
In point of fact, the vulnerability you're referring to is a Rails vulnerability that has since been patched; you have zero guarantees that there won't be other Ruby or Rails vulnerabilities in the future---or, in fact, network or OS vulnerabilities---that target different parts of the MVC or OS stack. Therefore, I'm not sure what you think you'd gain from a risk-management perspective by painting SQL as the inherent villain in this story.
SQL injections are a problem which is known for decades and well-understood. There are coding practices which make SQL injections completely impossible when you adhere to them:
Run all variables through escape functions before putting them into a query
Use prepared statements
Use stored procedures
Always use at least one of these practices, and you don't have to be afraid of SQL injections.
MongoDB, on the other hand, is a rather new technology. It is not known yet what kind of newbie mistakes will be the most typical which lead to vulnerable applications. Maybe there is something just as bad as SQL injections everybody is doing right now without realizing. Maybe the exploit is already circulating among the black hat hackers. Who knows?
Also, as CodeGnome pointed out, MongoDB is not a drop-in replacement for an SQL database. It has a completely different philosophy. 83% of all MongoDB questions around here are asked by people who try to use MongoDB as if it were a relational database and wonder why it doesn't work out.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I've live project experience with CodeIgniter and Cake PHP. However now I need to work on a huge project for which both are unsuitable. I'm nearly decided to go with symfony 1.4 (2.0 isn't an option, according to my client's requirements).
In Symfony 1.4 too, I'm confused between ORM choice: Doctrine or Propel? I went through few links. Best found so far is
PHP ORMs: Doctrine vs. Propel.
However all those comparisons seem a minimum of two years old and definitely the world would have changed a lot since than. I do not have any issue with coding style; I'm fine with all Active Record, Criteria, DQL or whatever. For me, performance is most important than coding style comes at last. I'm mainly concerned about performance while dealing lot of data, probably millions of rows from multiple tables under clustered database. Unfortunately right now my experience is not sufficient to take independent decision on that matter.
Can anyone please shed some light on performance of Propel/Doctrine under Symfony 1.4? Other than performance, is there any other notable factor (except coding style) which one should take care while choosing PHP ORM?
tl;dr: I used Doctrine for a long time and I will choose Propel if I have to start something new.
This is such a common question that has nearly no good answer. But I will just give you my point of view.
I've worked with Doctrine since the first alpha (and with the old symfony 0.63). We choose Doctrine instead of Propel because Doctrine supported PDO (which is native to PHP) and Propel was still running on Creole (which isn't native). Creole was very slow in comparison to PDO (of course).
Recently, Doctrine added lost of a magic. I mean, you could call getField, findOneByField for everything and it would return what you want. It was something really great instead of having to build your own getter and setter. Magic was really trendy at this time.
Writing query using Doctrine was really easy instead of the painful Criteria and Criterion from Propel, which was really verbose. I was really fan of Doctrine and recommended to everyone to start using it instead of Propel.
Then, Propel switch to PDO as of 1.3 and started to have a nice API to write query, almost the same approach as Doctrine. The main difference was that Propel generate all magic things while Doctrine build on the fly. That's the biggest difference I think.
Propel doesn't have any magic in this code. It generates all getter/setter, join, etc .. when you build your model. Doctrine does every thing when it run the query. That's okay for small to medium project, but it starts to be bigger, it will become a slow solution. And it's great for debugging too, because you find the code in generated classes, you don't have to jump from classes to classes to find the global method that handle this case.
Both ORM use behaviors. I love behaviors. They are handled in different way in Doctrine and Propel. Doctrine still use its magic to handle them where Propel generates everything from the behavior inside the class (one more point from generated class instead of magic one).
As of now, nothing has really changed in Doctrine (to give a shot from the thread you mention) because of Doctrine 2 (which isn't native at all for sf 1.4) since the 1.2.x branch is almost dead (last release are 24/08/2010). Propel is still active, well really active, as you can see on github.
I still work with Doctrine but I've learn a lot from Propel since few years. I've build some personal projects on Doctrine. As of today, I changed my mind, and if I have to start a new project I will do it using Propel.
Few links:
Should I choose Doctrine 2 or Propel 1.5/1.6, and why? (on programmers.se)
The POV from the Propel lead dev on this choice (in favor to Propel, of course)
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
DataMapper idea is definitely better than ActiveRecord. It has one API for a variety of data stores, including RDBMS and NoSQL stores.
DataMapper is much smarter then ActiveRecord. It has "Strategic Eager Loading". This feature single-handedly wipes out the "N+1 Query Problem". Additionally it allows lazy-loading of heavy fields like Text property. DataMapper allows you to create and search for any complex object graph simply by providing a nested hash of conditions. ActiveRecods is unsuitable to be used for associations in production. include method is ugly and unconfigurable. In October 2010 Josh Symonds makes a patch for this method to allow fields to be excluded from eager loaded. But that path was ignored and today in rails3 we have same ugly include method.
Even in Rails3 with brilliant AREL, ActiveRecord is far from the best orm for rails. You may say "wow, that new gem metawhere allows to write nice code like Article.where(:title.matches => 'Hello%', :created_at.gt => 3.days.ago)". But wait... DataMapper supports this out of a box! Maybe instead of modifying ActiveRecord to looks like DataMapper better is to extend and support better orm? More details of DataMapper can be found at http://datamapper.org/.
I think, that rails in later releases should allow us to select which orm to use, like now it allows a database selection. Even it will has only one option "ActiveRecord", people will search for available alternatives. When I was starting to learn rails, I thought that there is support only for ActiveRecord. And later I did not even try to look for something else.
Why I am writing all this stuff? I think, that we need to pay more attention to this nice ORM. If you are developer of some popular or not so popular gem, think about adding support of DataMapper. DataMapper community should write some migration guides from ActiveRecord or another ORM and keep documentation uptodate and your may help them. As for me, DataMapper community needs more people and you may be one of them.
The only disadvantage of this ORM is lack of documentation and you may help.
So what do you think about that?
Rails 3 allows you to use Datamapper, just not by default. It you do want to use datamapper with rails 3. Just do this
rails new project_name -m http://datamapper.org/templates/rails.rb
Rails allows you to select, you can even use the --skip-active-record option. :) ( May not be straightforward but its there.
And yeah, Datamapper is awesome. :)
The lack of documentation is a huge issue. I've begun my databasing using DataMapper and have since decided to implement a web interface for my data. Incorporating DM into Rails, as a beginner in each, has been a tremendous challenge. Hence, I'm curious, do you know of any resources which show DM/Rails usage? I'd love to be able to see something when I'm not sure how to proceed.