I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.
thanks in advance.
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.
thanks in advance.
Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.thanks in advance.
As always, it depends on what you want to do. Postgres might be an alternative - especially since it has proper transaction support, stored procedures etc. significantly longer than MySQL.
Kind regards
robert
I suggest using http://ruby-dbi.rubyforge.org to help keep your code database-independent.
-- Daniel
On Mar 25, 2006, at 11:48 PM, Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.
You can download Informix for Linux from here:
http://www14.software.ibm.com/webapp/download/search.jsp?go=y&rs=ifxsee
and use it with Ruby with this:
http://ruby-informix.rubyforge.org
I'm running Informix on Solaris and Fedora Core 4 without any problem.
I've found Informix very nice.
2006/3/25, Butternut squash <rrrn@yahoo.com>:
thanks in advance.
--
Gerardo Santana
"Between individuals, as between nations, respect for the rights of
others is peace" - Don Benito Juárez
Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.thanks in advance.
PostgreSQL www.postgresql.org
#for ruby db interaction....
gem install postgres
gem install postgres-pr
# http://nitrohq.com http://www.nitrohq.com/view/Og
gem install nitro -y
PostgreSQL and Og work very well...
simple example -- playing around with ruby and postgresql on win XP..
10000 inserts in ~54 seconds ( pentium 4, 2+ghz, 1GB ram )
ogtest.rb
--------------------
require 'og'
class Comment
property :title, String
property :body, String
property :author, String
property :create_time, Time
end
og_psql = {
:destroy => false,
:store => :psql,
:user => 'rthompso',
:password => 'rthompso',
:name => 'testog'
}
Og.setup(og_psql)
puts Time.now
# save the object in the database
1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}
puts Time.now
Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.
Alot of folks have already mentioned Postgresql. I hear there is iffy blob support if you use it
with ActiveRecord (and the rest of Rails). I can't say for Nitro/Og.
I use Mysql without any issue. It has served me well at work, at home and on the side.
Zach
if your applications really need network connectivity the consider mysql or
postrgresql - if they do not it's madness not to use sqlite, which has great
ruby support.
regards.
-a
On Sun, 26 Mar 2006, Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.thanks in advance.
--
share your knowledge. it's a way to achieve immortality.
- h.h. the 14th dali lama
Well, apparently you can, according to somebody else's post. However, if that still doesn't appear to be a good choice, I'd also have to recommend PostgreSQL over MySQL. I learned SQL on Microsoft SQLServer 6.5, and PostgreSQL generally acted a lot more like what I was expecting than MySQL could. MySQL has grown a lot since I checked them both out, but so has Postgres, and I still find Postgres's behavior to be closer to what I've come to expect out of a "real" SQL relational database. It's more paranoid about data integrity, for one thing, and is willing to let me enforce very strict measures indeed.
The biggest nuisance is that outer joins use a very different syntax than what I'm used to. {shrug}
On Mar 25, 2006, at 14:48, Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.
I've never used og, but I suspect that'd drop to < 10s if you wrapped
it all in a transaction.
On 3/25/06, Reid Thompson <reid.thompson@ateb.com> wrote:
Butternut squash wrote:
> I want to learn DB and SQL using Ruby
>
> Project is not too big. Probably need 30 tables
>
> Everyone at work tells me MySQL is the best... I used to use Informix a long
> time ago. It doesn't look like I can get this for linux.
>
> thanks in advance.
>
>
PostgreSQL www.postgresql.org#for ruby db interaction....
gem install postgres
gem install postgres-pr
# http://nitrohq.com http://www.nitrohq.com/view/Og
gem install nitro -yPostgreSQL and Og work very well...
simple example -- playing around with ruby and postgresql on win XP..
10000 inserts in ~54 seconds ( pentium 4, 2+ghz, 1GB ram )ogtest.rb
--------------------
require 'og'class Comment
property :title, String
property :body, String
property :author, String
property :create_time, Time
endog_psql = {
:destroy => false,
:store => :psql,
:user => 'rthompso',
:password => 'rthompso',
:name => 'testog'
}Og.setup(og_psql)
puts Time.now
# save the object in the database
1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}
puts Time.now
But will using sqlite help one trying to learn SQL?
ara.t.howard@noaa.gov wrote:
On Sun, 26 Mar 2006, Butternut squash wrote:
I want to learn DB and SQL using Ruby
...
if your applications really need network connectivity the consider mysql or
postrgresql - if they do not it's madness not to use sqlite, which has great
ruby support.
--
James Britt
Ruby Code & Style - The Journal By & For Rubyists
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.30secondrule.com - Building Better Tools
Pat Maddox wrote:
Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.thanks in advance.
PostgreSQL www.postgresql.org
#for ruby db interaction....
gem install postgres
gem install postgres-pr
# http://nitrohq.com http://www.nitrohq.com/view/Og
gem install nitro -yPostgreSQL and Og work very well...
simple example -- playing around with ruby and postgresql on win XP..
10000 inserts in ~54 seconds ( pentium 4, 2+ghz, 1GB ram )ogtest.rb
--------------------
require 'og'class Comment
property :title, String
property :body, String
property :author, String
property :create_time, Time
endog_psql = {
:destroy => false,
:store => :psql,
:user => 'rthompso',
:password => 'rthompso',
:name => 'testog'
}Og.setup(og_psql)
puts Time.now
# save the object in the database
1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}
puts Time.nowI've never used og, but I suspect that'd drop to < 10s if you wrapped
it all in a transaction.
yep - was just meant to show a simple usage with stats... but, since i'm interested anyway...
Different machine - athlon 2500, 512MB RAM, windows XP -- postgresql 8.0.3 rather than PostgreSQL 8.1.3 and running ruby from cygwin rather than natively....
Runs in 12-13 seconds -- entirely possible that the other box( p4, 2+ghz, 1GB ram, native ruby ) could drop it down under 10 seconds( or even this box, if I took cygwin out of the equation ).
db =Og.setup(og_psql)
t1= Time.now
db.store.start
1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}
db.store.commit
puts Time.now - t1
On 3/25/06, Reid Thompson <reid.thompson@ateb.com> wrote:
no one can help someone using sql, we can only watch in dismay and horror
seriously though - why not? all the bloody dbs have there own dialect - might
as well commit to either learning to learn them or to not and using dbi - in
either case sqlite fits in.
besides - i think a good hacker could learn the entire sqlite dialect in the
time it takes to install mysql and get authentication and networking running
properly. especially once we throw user 'www' into the mix
regards.
-a
On Sun, 26 Mar 2006, James Britt wrote:
if your applications really need network connectivity the consider mysql or
postrgresql - if they do not it's madness not to use sqlite, which has
great ruby support.But will using sqlite help one trying to learn SQL?
--
share your knowledge. it's a way to achieve immortality.
- h.h. the 14th dali lama
http://www.sqlite.org/omitted.html\). I use sqlite frequently and I was
always amazed of its ease to use. As stated above there is no need to look
at MySQL or Postgre unless you really need their features - network support
comming into mind. They are great products, do not get me wrong, but they
are very probably much more than you need.
Now when it comes to learning you might use all of them and more of course (
e.g. Firebird which seeems quite nice too and has pretty good ANSI-SQL
support. http://firebird.sourceforge.net/\)
Hope you find that helpfull.
Robert
On 3/26/06, James Britt <james_b@neurogami.com> wrote:
ara.t.howard@noaa.gov wrote:
> On Sun, 26 Mar 2006, Butternut squash wrote:
>
>> I want to learn DB and SQL using Ruby
>> ...> if your applications really need network connectivity the consider mysql
or
> postrgresql - if they do not it's madness not to use sqlite, which has
> great
> ruby support.But will using sqlite help one trying to learn SQL?
--
James Britt
Ruby Code & Style - The Journal By & For Rubyists
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.30secondrule.com - Building Better ToolsSQLite (http://www.sqlite.org) has good SQL92 support (execeptions are
--
Deux choses sont infinies : l'univers et la bêtise humaine ; en ce qui
concerne l'univers, je n'en ai pas acquis la certitude absolue.
- Albert Einstein
Reid Thompson wrote:
Pat Maddox wrote:
Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.thanks in advance.
PostgreSQL www.postgresql.org
I think the debate between Postgres and MySQL is about as inflammatory as vi and emacs. However I'm of the opinion that Postgres is ultimately a better database if you are going to do real database things where the data is changing frequently (INSERT, UPDATE, DELETE) as opposed to just reading it.
But I haven't any hard metric data to support any of this.
Unless there's something specifically ruby-esque to make the advantage clearer.
Postgres is nicely object oriented if you are into that sort of thing.
On 3/25/06, Reid Thompson <reid.thompson@ateb.com> wrote:
Reid Thompson wrote:
Pat Maddox wrote:
Butternut squash wrote:
I want to learn DB and SQL using Ruby
Project is not too big. Probably need 30 tables
Everyone at work tells me MySQL is the best... I used to use Informix a long
time ago. It doesn't look like I can get this for linux.thanks in advance.
PostgreSQL www.postgresql.org
#for ruby db interaction....
gem install postgres
gem install postgres-pr
# http://nitrohq.com http://www.nitrohq.com/view/Og
gem install nitro -yPostgreSQL and Og work very well...
simple example -- playing around with ruby and postgresql on win XP..
10000 inserts in ~54 seconds ( pentium 4, 2+ghz, 1GB ram )ogtest.rb
--------------------
require 'og'class Comment
property :title, String
property :body, String
property :author, String
property :create_time, Time
endog_psql = {
:destroy => false,
:store => :psql,
:user => 'rthompso',
:password => 'rthompso',
:name => 'testog'
}Og.setup(og_psql)
puts Time.now
# save the object in the database
1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}
puts Time.nowI've never used og, but I suspect that'd drop to < 10s if you wrapped
it all in a transaction.yep - was just meant to show a simple usage with stats... but, since i'm interested anyway...
Different machine - athlon 2500, 512MB RAM, windows XP -- postgresql 8.0.3 rather than PostgreSQL 8.1.3 and running ruby from cygwin rather than natively....
Runs in 12-13 seconds -- entirely possible that the other box( p4, 2+ghz, 1GB ram, native ruby ) could drop it down under 10 seconds( or even this box, if I took cygwin out of the equation ).
db =Og.setup(og_psql)
t1= Time.now
db.store.start1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}db.store.commit
puts Time.now - t1
Upated athlon system to PostgreSQL 8.1.3
8.78-9.2 seconds...
On 3/25/06, Reid Thompson <reid.thompson@ateb.com> wrote:
Reid Thompson:
Runs in 12-13 seconds -- entirely possible that the other box( p4,
2+ghz, 1GB ram, native ruby ) could drop it down under 10 seconds( or
even this box, if I took cygwin out of the equation ).db =Og.setup(og_psql)
t1= Time.now
db.store.start1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}db.store.commit
puts Time.now - t1Upated athlon system to PostgreSQL 8.1.3
8.78-9.2 seconds...
As Ara said: "it's madness not to use sqlite" if you don't need the
networking capabilities of MySQL or whatever.
change DB to sqlite3:
-----------------------------------------------------------
require 'sqlite3'
File.delete("test.db") if File.exists?("test.db")
db = SQLite3::Database.new("test.db")
t1= Time.now
db.execute("CREATE TABLE comments (title, body, create_time, author)")
db.transaction do
1.upto(10000) do
db.execute("insert into comments values ('Hello', 'World', ?, 'tml'
)", Time.now)
end
end
puts Time.now - t1
------------------------------------------------------------
1.5 seconds
(Pentium M, 2.13GHz, 1GB RAM)
cheers
Simon
Tom Allison <tallison@tacocat.net> writes:
I think the debate between Postgres and MySQL is about as inflammatory
as vi and emacs.
Of course, the difference is that *both* vi and emacs are very good editors...
*scnr*
--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org
Tom Allison wrote:
Postgres is nicely object oriented if you are into that sort of thing.
Now, I don't want to veer way off topic for either this thread or this
list, but I was wondering what brings you to say that? I've never
thought of any particular DB being more or less OO.
Recently, I investigated Postgres' table inheritance feature, but found
it to be lacking in robustness. Constraints are not carried over to
child tables, and even if you redeclare them in child table definitions,
UNIQUE constraints are not enforced across the rows of both tables
(i.e., you can have a row with table1.id = 1 and a row with table2.id =
1).
To me, this makes it (inheritance, not Postgres as a whole) seem okay
for toy applications, but not for anything serious.
(For the record, I prefer Postgres, but only because at the time I made
my choice, MySQL was lacking in "serious" DB features.)
/me leaves it at that, not wanting to argue PG vs. MySQL
--
Posted via http://www.ruby-forum.com/\.
Simon Kröger wrote:
Reid Thompson:
Runs in 12-13 seconds -- entirely possible that the other box( p4,
2+ghz, 1GB ram, native ruby ) could drop it down under 10 seconds( or
even this box, if I took cygwin out of the equation ).db =Og.setup(og_psql)
t1= Time.now
db.store.start1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}db.store.commit
puts Time.now - t1Upated athlon system to PostgreSQL 8.1.3
8.78-9.2 seconds...
As Ara said: "it's madness not to use sqlite" if you don't need the
networking capabilities of MySQL or whatever.change DB to sqlite3:
-----------------------------------------------------------
require 'sqlite3'File.delete("test.db") if File.exists?("test.db")
db = SQLite3::Database.new("test.db")
t1= Time.nowdb.execute("CREATE TABLE comments (title, body, create_time, author)")
db.transaction do
1.upto(10000) do
db.execute("insert into comments values ('Hello', 'World', ?, 'tml'
)", Time.now)
end
endputs Time.now - t1
------------------------------------------------------------
1.5 seconds(Pentium M, 2.13GHz, 1GB RAM)
cheers
Simon
agreed, if sqlite meets your needs, it would be the tool to use. IMO it is an exceptional piece of software for what it is designed to do.
Being someone who has done a fair amount of development on Og, I can tell you that this isn't just the database performance, the sqlite adapter is leaner than the others since the project lead uses it and the others definitely need a lot of optimization.
I can also tell you that having watched insert performance postgresql vs sqlite that postgresql usually beat it heavily on my machine, but my machine was slower than yours.
On 27 Mar 2006, at 18:23, Reid Thompson wrote:
Simon Kröger wrote:
Reid Thompson:
Runs in 12-13 seconds -- entirely possible that the other box( p4,
2+ghz, 1GB ram, native ruby ) could drop it down under 10 seconds( or
even this box, if I took cygwin out of the equation ).db =Og.setup(og_psql)
t1= Time.now
db.store.start1.upto(10000) { |i|
c = Comment.new
c.title = 'Hello'
c.body = 'World'
c.create_time = Time.now
c.author = 'tml'
c.save
}db.store.commit
puts Time.now - t1Upated athlon system to PostgreSQL 8.1.3
8.78-9.2 seconds...As Ara said: "it's madness not to use sqlite" if you don't need the
networking capabilities of MySQL or whatever.change DB to sqlite3:
-----------------------------------------------------------
require 'sqlite3'File.delete("test.db") if File.exists?("test.db")
db = SQLite3::Database.new("test.db")
t1= Time.nowdb.execute("CREATE TABLE comments (title, body, create_time, author)")
db.transaction do
1.upto(10000) do
db.execute("insert into comments values ('Hello', 'World', ?, 'tml'
)", Time.now)
end
endputs Time.now - t1
------------------------------------------------------------
1.5 seconds(Pentium M, 2.13GHz, 1GB RAM)
cheers
Simon
agreed, if sqlite meets your needs, it would be the tool to use. IMO it is an exceptional piece of software for what it is designed to do.
Rob Pitt
Technical Architect
Motionpath Digital Media Ltd.
St Georges Road, Brighton, BN2 1ED.
Office: 01273 608708