469,366 Members | 2,360 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

how to connect to a database by ruby, and modify, add or delete?

can ruby access, existing MySQL databases to modify
(add information, search or running queries)

if yes please let me know
Sep 6 '07 #1
4 6676
rustyc
5
Yes, you should be able to do that, but it will be MUCH easier to do if your database follows the rules for table names.

I'd suggest a look at some of the standard tutorials, or even (gasp) go get the 'official' ruby on rails book - go to http://www.rubyonrails.org/ and find the 'agile web development with rails' book. Shoot, you can even download it (for a price).

Since you ask only about ruby, and not rails, the 'other' main book on Ruby alone might be all you need. Again, google is your friend here - look for "Programming Ruby: the Pragmatic Programmer's Guide".

Note that, in my experience, the Rails book is enough to get you going, but not necessarily in the best direction. I'm still fighting with my web application, and I finally find out that I'm woefully messed up in handling the transition from 'thing on the web page that came from the database' to 'saving the changed thing back to the database' when the web page is of my creation and not of the scaffold....
Sep 6 '07 #2
improvcornartist
303 Expert 100+
You may need to create a new data source. Then you should be able to connect with
Expand|Select|Wrap|Line Numbers
  1. DBI.connect("dbi:ODBC:MyDSNName", "username", "password")
  2.  
Sep 7 '07 #3
rustyc
5
Boy, improvcornartist, you got me - I forgot all about the db setup config file in rails. I should have mentioned 'config/database.yml' as where you'd need to go set up your database, IF you are using Ruby on Rails....
Sep 7 '07 #4
pardon, but it seems I'm having problems in installing ruby

first I installed ruby
then I installed gems then rails but the problem is that I want an interface for ruby instead of using bash, it might be confusing sometimes
also I want to know how to run ruby (I've been using irb)
and now I'm trying to install NetBeans

that if you offered help, I would be thankful
thanks in advance
Sep 8 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Sarah Tanembaum | last post: by
220 posts views Thread by Brandon J. Van Every | last post: by
54 posts views Thread by Brandon J. Van Every | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.