# Read Database Metadata

**URL:** <https://www.ruby-forum.com/t/read-database-metadata/154271>\
**Category:** Ruby\
**Created:** [November 27, 2008, 6:49am UTC](https://www.ruby-forum.com/t/read-database-metadata/154271 "2008-11-27T06:49:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![xdork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/22d042/32.png) [@xdork](https://www.ruby-forum.com/u/xdork)\
**Post date:** [November 27, 2008, 6:49am UTC](https://www.ruby-forum.com/t/read-database-metadata/154271/1 "2008-11-27T06:49:36Z")

</div>

Hi All,

I’m reviewing Ruby if its appropriate for my project. I’m planning to  
port my existing application made from Java to Ruby but before I do that  
I have to check if Ruby have capablities of doing the following:

1. Connect to different Database.
2. Read Database Metadata.
3. JDBC like way of communicating with databases.

I would really appreciate if you can name some APIs and documents that  
may enlighten me with my queries.

Thanks in advance,  
Jag

---

<div class="post-metadata">

**Author:** ![xdork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/22d042/32.png) [@xdork](https://www.ruby-forum.com/u/xdork)\
**Post date:** [November 27, 2008, 1:38pm UTC](https://www.ruby-forum.com/t/read-database-metadata/154271/2 "2008-11-27T13:38:57Z")

</div>

Xd Ork wrote:

> I’m reviewing Ruby if its appropriate for my project. I’m planning to  
> port my existing application made from Java to Ruby but before I do that  
> I have to check if Ruby have capablities of doing the following:
> 
> 1. Connect to different Database.
> 2. Read Database Metadata.
> 3. JDBC like way of communicating with databases.

You can certainly connect to different databases and read metadata. I  
have no idea what a “JDBC like way” of communicating with databases  
means.

> I would really appreciate if you can name some APIs and documents that  
> may enlighten me with my queries.

[http://ar.rubyonrails.com/](http://ar.rubyonrails.com/) [used by Rails]  
[http://sequel.rubyforge.org/](http://sequel.rubyforge.org/)  
[http://datamapper.org](http://datamapper.org)  
[http://www.nitroproject.org/](http://www.nitroproject.org/) [look for og]

Plus you have the lower-level ruby-dbi, and then the low-level APIs for  
the native databases (e.g. ruby-oci8 for Oracle)

---

<div class="post-metadata">

**Author:** ![xdork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/22d042/32.png) [@xdork](https://www.ruby-forum.com/u/xdork)\
**Post date:** [November 27, 2008, 1:55pm UTC](https://www.ruby-forum.com/t/read-database-metadata/154271/3 "2008-11-27T13:55:21Z")

</div>

On Nov 27, 2008, at 6:44 AM, Xd Ork wrote:

> 

If you want do have a behaviour that matches JDBC, use JRuby and  
JDBC ;).

But to make things clear: Ruby as well as Java has no idea what a  
database is.  
So it is not a “Ruby capability”. But there are enough well-tested  
libraries for  
doing this in a lot of fashions that you can imagine. Databases are no  
problem.

Regards,  
Florian G.

---

<div class="post-metadata">

**Author:** ![xdork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/22d042/32.png) [@xdork](https://www.ruby-forum.com/u/xdork)\
**Post date:** [November 28, 2008, 1:44am UTC](https://www.ruby-forum.com/t/read-database-metadata/154271/4 "2008-11-28T01:44:58Z")

</div>

Florian G. wrote:

> On Nov 27, 2008, at 6:44 AM, Xd Ork wrote:
> 
> > 
> 
> If you want do have a behaviour that matches JDBC, use JRuby and  
> JDBC ;).
> 
> But to make things clear: Ruby as well as Java has no idea what a  
> database is.  
> So it is not a “Ruby capability”. But there are enough well-tested  
> libraries for  
> doing this in a lot of fashions that you can imagine. Databases are no  
> problem.
> 
> Regards,  
> Florian G.

Thanks Florian for the reply.  
I already tried JRuby and JDBC but I was thinking that since JDBC is  
really for java, my code will then be only run in JRuby, making my  
application requires their runtime which for me is not ideal and there’s  
is no point anymore of migrating my old java application to ruby. I’m  
looking for a library which works like JDBC. I googled around and found  
Ramen but it only works now for few database. Can you name some library?

---

<div class="post-metadata">

**Author:** ![xdork](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/22d042/32.png) [@xdork](https://www.ruby-forum.com/u/xdork)\
**Post date:** [November 28, 2008, 1:50am UTC](https://www.ruby-forum.com/t/read-database-metadata/154271/5 "2008-11-28T01:50:34Z")

</div>

Brian C. wrote:

> Xd Ork wrote:
> 
> > I’m reviewing Ruby if its appropriate for my project. I’m planning to  
> > port my existing application made from Java to Ruby but before I do that  
> > I have to check if Ruby have capablities of doing the following:
> > 
> > 1. Connect to different Database.
> > 2. Read Database Metadata.
> > 3. JDBC like way of communicating with databases.
> 
> You can certainly connect to different databases and read metadata. I  
> have no idea what a “JDBC like way” of communicating with databases  
> means.
> 
> > I would really appreciate if you can name some APIs and documents that  
> > may enlighten me with my queries.
> 
> [http://ar.rubyonrails.com/](http://ar.rubyonrails.com/) [used by Rails]  
> [http://sequel.rubyforge.org/](http://sequel.rubyforge.org/)  
> [http://datamapper.org](http://datamapper.org)  
> [http://www.nitroproject.org/](http://www.nitroproject.org/) [look for og]
> 
> Plus you have the lower-level ruby-dbi, and then the low-level APIs for  
> the native databases (e.g. ruby-oci8 for Oracle)

Hi,

In JDBC, to connect into a database you just need to have a driver for  
the database you want to connect to. Once connected you can get the  
metadata of the database and query its properties. Same code and logic  
will work in any database. These are the kinds of freatures I’m looking  
if there is an equivalent in Ruby.

Thanks  
Jag
