Ruby on Rails with Oracle

I am working on a prototype in an big company and they do store data in Oracle. It took me some time to set up RoR working with Oracle. So, here are the things you need to do.

First of all, there is a great tutorial on Oracle site:
In fact, you need to:

Download Ruby OCI library from

Configure access to Oracle in database.yml

Create a sequencer for each table (rails uses it to generate id). The sequencer must follow naming convention (see script below). You can create one using:

Since I am using one of the non-english character sets and the Oracle instance uses ISO 8859-2 and it is not compatible with Windows code page, I had problems with encoding. To avoid it, it is necessary to set up variable NLS_LANG. I did it in environment.rb.

Now you should be able to access the data source, perform basic operations with data, and see the data correctly.

Ruby on Rails in enterprise

Ruby is great! Ruby is cool! It will penetrate in enterprises within few months.
These are some of the ideas that occupies one’s mind during the RoR excitement period. But things are not always so simple.

Enterprises does not behave same as small companies do. Their IT complexity reached one of the highest level and the only way how to manage it, is to follow internal standards and management rules. Complexity is the reason why the big companies are often so rigid concerning new platforms.
The enterprise IT managers expects

  • Strong partner that can help in case of big troubles
  • Wide specialist support on market, not to be too dependent on one vendor and to be able to expand system built on new technology themselves
  • Technical support, bug fixes, hot-line… simply, a set of services that guarantees quick production problem fix
  • Consolidation – the managers does not want to add new platform to the enterprise. And if they add one, they expect at least one platform will go away

Fortunatelly, there are still oportunities for new platfoms. If there is a need for certain functionality and the only acceptable is built on a new technology, it is probable that the new technology will come into the enterprise.


And RoR covers a need that is very important and currently does not have any reasonable alternative. RoR could be used for prototyping.

  • You do not need a strong partner for prototyping, because the prototype should never go into production.
  • You do not really need a wide specialist support. If the enterprise does not have the RoR specialists, it can behave the same as before
  • There is not high demand for technical support. Simply, if something minor does not work in prototype, nothing happens. Business will understand it.
  • Consolidation is also “no issue”. The platform is needed for a short period of time, it will never be in production and thus does not cause addiditonal mess in IT environement.

I have discussed this issue with few companies delivering to enterprises. They currently use prototyping, but it is based on java or .Net. They create a set of screens that is used for further application generation. I can see few weak points in this approach

  • Prototype is not part of the development phase, but part of the analytical phase. Its main purpose is to communicate user requirements. No user will tell you what he/she wants without your help. The best help I can see is a working application. Once something works, users starts to imagine the possibilities.
  • Prototype should be thrown away. It should not be used for further development. Simply, during the prototyping phase there is a lot of garbage code created.

Why Rails?

Let me do small +/- analysis


  • It uses enterprise design patterns like Active record, MVC (Model View Controller) and what is the most important, it is hard to avoid it!
  • Since the RoR uses the patterns, it will be a solid base for high quality design of the final application
  • RoR is build on ruby. Thus the prototype must be thrown away. I know, managers does not like to throw anything away, but from my experience, the best pieces of code are the ones that were lost and I did rewrite them completely.
  • Increases productivity (I have seen a comparison of ruby/java productivity. It was around 10:1. Nevertheless, from my experience, creation of an application skeleton in RoR is faster than configuration of hibernate)


  • No big player supporting it. This is not a problem for prototyping. It could be a competitive advantage of smal flexible companies. And of course, this might change.
  • Missing integration to enterprise systems like domain controllers, messaging systems…
  • It brings a new platform into enterprise
  • There is stil not enough specialists to build stable teams. There are specialised companies that uses RoR, but enterprises needs massive support.

Nevertheless, in prototyping, the mentioned issues are minor ones.


So what should be expected in the near future? It seems, that developer’s community is growing. But not only in small companies. Our blog have hits from the biggest IT companies.
I expect that sooner or later the big consulting companies will add RoR into their standard portfolio of supported technologies.