[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

dtabase access with Ruby

Sijo Kg

9/3/2008 10:58:00 AM

Hi
If myb doubt is a stupidity please forgive..I was reading a ruby
book as part of learning Ruby and I reached heading accessing database
with Ruby I have installed and running rails project..In the book it
says two methoda to connect a ruby program to database .
Ruby/DBI and
Ruby/odbc
And for the sample program one require "dbi" and other require "odbc"
I tried both these but getting no file to load? So my doubt is if these
are the two methods for accessing database from Ruby how could I access
database without anyof these two in Rails ?Is rails strategy differnet?
I did not understand That is why asking Could you please explain with a
simple code fragment to how a simple ruby program can be connected to
the database I am using postgres And another doubt is if I install dbi
will there any conflict with existing rails functionality?

Thanks in advance
Sijo
--
Posted via http://www.ruby-....

5 Answers

Roger Pack

9/3/2008 12:15:00 PM

0


> And for the sample program one require "dbi" and other require "odbc"
> I tried both these but getting no file to load? So my doubt is if these
> are the two methods for accessing database from Ruby how could I access
> database without anyof these two in Rails ?Is rails strategy differnet?
> I did not understand That is why asking Could you please explain with a
> simple code fragment to how a simple ruby program can be connected to
> the database I am using postgres And another doubt is if I install dbi
> will there any conflict with existing rails functionality?
>
> Thanks in advance
> Sijo

shouldn't be a conflict
I know you can find some postgres rails examples [google "postgres
rails"] however I did't see any easy links out there to how to just use
the postgres gem by itself [no rails].
Cheers.
-=R
--
Posted via http://www.ruby-....

Todd Benson

9/3/2008 2:10:00 PM

0

On Wed, Sep 3, 2008 at 5:58 AM, Sijo Kg <sijo@maxxion.com> wrote:
> Hi
> If myb doubt is a stupidity please forgive..I was reading a ruby
> book as part of learning Ruby and I reached heading accessing database
> with Ruby I have installed and running rails project..In the book it
> says two methoda to connect a ruby program to database .
> Ruby/DBI and
> Ruby/odbc
> And for the sample program one require "dbi" and other require "odbc"
> I tried both these but getting no file to load? So my doubt is if these
> are the two methods for accessing database from Ruby how could I access
> database without anyof these two in Rails ?Is rails strategy differnet?
> I did not understand That is why asking Could you please explain with a
> simple code fragment to how a simple ruby program can be connected to
> the database I am using postgres And another doubt is if I install dbi
> will there any conflict with existing rails functionality?
>
> Thanks in advance
> Sijo

You can use ActiveRecord without rails. Also, a few other ORM
projects are out there, one of them being the Sequel gem.

Todd

Sijo Kg

9/4/2008 4:17:00 AM

0

Could you please points to any links explaining to access Ruby(Not
rails) to ActiveRecord

Thanks
Sijo
--
Posted via http://www.ruby-....

Christopher Dicely

9/4/2008 7:14:00 AM

0

On Wed, Sep 3, 2008 at 9:17 PM, Sijo Kg <sijo@maxxion.com> wrote:
> Could you please points to any links explaining to access Ruby(Not
> rails) to ActiveRecord
>
> Thanks
> Sijo
> --
> Posted via http://www.ruby-....

Here's one: http://rails.aizatto.com/2007/05/21/activerecord-with...

For more, just Google "activerecord without rails".

Though if you aren't using Rails, you may want to look at other ORMs:
I personally like Sequel, but there are other alternatives.

Sijo Kg

9/4/2008 8:05:00 AM

0

Hi
Thanks for your reply
Sijo
--
Posted via http://www.ruby-....