rubyonrails-c4f1mTqwXZkdnm+yROfE0A@public.gmane.org
2004-Nov-10 16:13 UTC
Connecting to MySQL
Hi It just occured to me that I didn''t know how raile (Activerecord actually) connects to a MySQL server, so I went and checked out the code. To my surprise, it looks like activerecord is writing socket code to connect directly to the server and not using some mysql or dbi layer. Very impressive. However, now my question is, is there an advantage to using the mysql shared library? It''s been years since I looked at that library and I''m not sure what it does, other than it was written in C. Here''s a hypothetical question: Say I wanted to access a MySQL server (possibly local, possibly not) in an application (not rails). Would I be better off using the MySQL shared library or using something like ActiveRecord? When I say ''better off'', I am mainly referring to speed, but, ease of use matters as well. Anyway, thanks for listening to my ramblings. All insights are appreciated. -- Jim Freeze
On Wed, Nov 10, 2004 at 04:13:55PM +0000, rubyonrails-c4f1mTqwXZkdnm+yROfE0A@public.gmane.org wrote:> Hi > > It just occured to me that I didn''t know how raile (Activerecord actually) > connects to a MySQL server, so I went and checked out the code. > To my surprise, it looks like activerecord is writing socket code > to connect directly to the server and not using some mysql or > dbi layer. Very impressive.Hi, In the case of MySQL, ActiveRecord ships with a Ruby implementation of the library, OR it can use the C version which you can download separately. I can''t speak of speed differences since I use PostgreSQL, but there are those two options available for MySQL. -Scott