Hi, list! I''m new to Ruby and FXRuby, and I''m trying to develop an application that needs to access a mysql database. Do you have any hints on how do I get started with it? Any help will be appreciated. Thanks, -- angico ------ home page: www.angico.org Gnu/Linux, FLOSS, Espiritismo, e eu por mim mesmo 8^I ------ contatos: email: angico at angico.org skype: angico00 ------
On Jun 25, 2008, at 4:11 PM, angico wrote:> I''m new to Ruby and FXRuby, and I''m trying to develop an application > that needs to access a mysql database. > > Do you have any hints on how do I get started with it? Any help will > be > appreciated.I''d recommend learning about those topics separately instead of trying to learn them all at once. That is to say, the issues involved in accessing MySQL databases aren''t really related to the issues involved in developing FXRuby-based applications. I think most people use the Ruby/MySQL library to deal with MySQL databases; here''s a good article on that topic: http://www.kitebird.com/articles/ruby-mysql.html The best resource for getting started with FXRuby development is the book (see my signature for the details). There are also some tutorials on line (Google for "fxruby tutorial"), and coverage in other books like "The Ruby Way". Hope this helps, Lyle --- "FXRuby: Create Lean and Mean GUIs with Ruby" Now available from the Pragmatic Bookshelf! http://www.pragprog.com/titles/fxruby
I would second Lyle''s suggestion that the two are seperate issues. However, instead of interacting with the database directly via the mysql gem, you might instead want to consider some form of Object-Relational Manager (ORM). An ORM will wrap a lot of the SQL you are likely to write, and the rows you return, in Ruby objects and methods. There are several available for ruby: ActiveRecord (of rails fame): http://wiki.rubyonrails.org/rails/pages/ActiveRecord Sequel: http://sequel.rubyforge.org/ DataMapper (my personal favourite, but currently under heavy development) http://datamapper.org They can significantly reduce the amount of ''boilerplate'' SQL you have to write. Regards, Jon
fxruby-users-bounces at rubyforge.org wrote:> Hi, list! > > I''m new to Ruby and FXRuby, and I''m trying to develop an application > that needs to access a mysql database.Hi, Jonathan idea to use an Object Relational Mapper is just fine. We are using Active Record here. Be careful of one thing, though: if your application is running on a LAN, I guess there will be no speed problem at all. But if you run your application on a higher latency network (for example 40 ms latency between the client and the server), be careful not to do to many round-trips between the client and the server, otherwise your application will be very slow... If you need to run complex algorithms requiring database access in your application, consider running them on the server directly. I have chosen to run them inside the Postgresql Database, in the form of PLPGSQL functions. This is 100% database dependant code, but so much faster... Regards, Philippe Lang http://www.attiksystem.ch