ODBC app in Ruby - I don't believe it.


E

Ed Reed

I'm trying to figure out what's so cool about Ruby. I need to create a
web app that runs on Windows 7 and talks to multiple ODBC data sources.
I wanted to start with just a simple app but I've been trying for three
days on three different machines with no success. I tried setting up
Ruby 1.9.2, 1.9.1, 1.8.2, and 1.8.6 and can't even begin to start
developing anything.

My steps have been
Uninstall and remove all existing Ruby installations
Install Ruby
install DevKit
run command gem install rails
run command gem install rake
run command gem install mysql
run command gem install mysql2
run command rails new mydbapp -d mysql
run command rails new mydbapp -d mysql2

I've tried numerous combinations of the above steps (obviously I didn't
perform both the mysql and mysql2 at the same time) and get errors on
install rails, install mysql, install mysql2, and rails new mydbapp.

I've searched the web for three days for answers to all the different
errors. I've found that many people seem to have the same or very
similar errors and it doesn't look like there's many successful
resolutions.

So since Ruby can't create a web database app on Windows 7 and there's
no descent place to find useful answers to problems that lead to
successful resolutions, and creating a simple app requires a ridiculous
number of steps to just set it up before you ever get to write any code,
what's so cool about it? I'm serious, I'd like an answer. I'd like to
see it work but all I've seen is errors. I don't think it can do it but
I've heard people say that it's the hot new way to do web db apps. I've
been writing web db apps for the past 12 years in a variety of languages
on numerous platforms and I've never had to deal with this. I don't see
how anyone can spend this much non-billable time before your ever get to
write any code. Can anyone answer any of these questions?
 
Ad

Advertisements

M

Markus Fischer

Hi Ed,

not much we can do here, since you didn't include any kind of error
message or specific question with a problem.

Maybe it's the Windows platform; maybe not. I'm working primarily on W7
as my workstation but it's such a horrible development environment I
always run a virtual machine either Debian or Ubuntu and therein no such
problems arose yet.

- Markus
 
J

Justin Collins

I'm trying to figure out what's so cool about Ruby. I need to create a
web app that runs on Windows 7 and talks to multiple ODBC data sources.
I wanted to start with just a simple app but I've been trying for three
days on three different machines with no success. I tried setting up
Ruby 1.9.2, 1.9.1, 1.8.2, and 1.8.6 and can't even begin to start
developing anything.

My steps have been
Uninstall and remove all existing Ruby installations
Install Ruby
install DevKit
run command gem install rails
run command gem install rake
run command gem install mysql
run command gem install mysql2
run command rails new mydbapp -d mysql
run command rails new mydbapp -d mysql2

I've tried numerous combinations of the above steps (obviously I didn't
perform both the mysql and mysql2 at the same time) and get errors on
install rails, install mysql, install mysql2, and rails new mydbapp.

I've searched the web for three days for answers to all the different
errors. I've found that many people seem to have the same or very
similar errors and it doesn't look like there's many successful
resolutions.

So since Ruby can't create a web database app on Windows 7 and there's
no descent place to find useful answers to problems that lead to
successful resolutions, and creating a simple app requires a ridiculous
number of steps to just set it up before you ever get to write any code,
what's so cool about it? I'm serious, I'd like an answer. I'd like to
see it work but all I've seen is errors. I don't think it can do it but
I've heard people say that it's the hot new way to do web db apps. I've
been writing web db apps for the past 12 years in a variety of languages
on numerous platforms and I've never had to deal with this. I don't see
how anyone can spend this much non-billable time before your ever get to
write any code. Can anyone answer any of these questions.

Hi Ed,

Sorry for your frustration. However, you seem to be conflating Ruby (the
language) and Ruby on Rails (the web framework). You might get better
answers on the Rails forum/mailing list: http://www.ruby-forum.com/forum/3

Some browsing around landed me here:
http://allaboutruby.wordpress.com/2009/07/20/installing-rails-on-windows-3-years-later/
which describes installing Ruby and Rails on Windows 7, so it certainly
is possible. Unfortunately, it does not describe using MySQL. Here's
another reference, which does mention MySQL:
http://www.hashemzahran.com/riding-the-rails-installing-ruby-on-rails/
My apologies if you have already seen these.

Without seeing the actual errors, I am afraid that's the best I can do.

-Justin
 
B

Brian Candler

Ed said:
I need to create a
web app that runs on Windows 7 and talks to multiple ODBC data sources. ...
run command gem install rails

You don't need Rails to talk to a database, nor to build a web app
(there are other options). But if you want to use Rails, then a Rails
forum would be a better place to ask. This forum is for Ruby, the
programming language.

In any case, I'd suggest you start with a basic hello-world type of web
app, perhaps using sqlite3 if you want a database, before getting it to
connect to some other data source.

You're putting yourself at a disadvantage by running under Windows, but
you could also look at some of the prepackaged bundles like Instant
Rails.

There's tons of documentation about Rails, so I'm sure with a bit of
googling you could find some quick-start guides for Rails under Windows.
run command gem install mysql
run command gem install mysql2

I don't use Windows myself, but I'm pretty sure you don't need the mysql
gem to talk to an ODBC data source.

For what it's worth, I do have a Rails app running under Linux talking
happily to MS SQL Server via ODBC. If I remember correctly, the bits I
needed were:

* unixODBC and unixODBC-devel
* freetds (Linux interface to SQL Server with ODBC API)
* ruby-odbc gem
* activerecord-sqlserver-adapter gem

config/environment.rb was something like:

development:
adapter: sqlserver
mode: odbc
dsn: XXXXXXX
username: xxxxxxxx
password: xxxxxxxx
 
M

Mike Stephens

I created a Ruby application (Windows Vista) that read and wrote to an
Access DB. It took under 5 minutes to build. You could hardly go any
faster with Access VBA.

Stick with Ruby but think twice about Rails. It looks very good to me
but personally I can do without all the complexity right now. It's for
certain types of applications written in certain ways. You probably
don't need it.
 
M

Michael Brooks

Ed Reed said:
I'm trying to figure out what's so cool about Ruby. I need to create a
web app that runs on Windows 7 and talks to multiple ODBC data sources.
I wanted to start with just a simple app but I've been trying for three
days on three different machines with no success. I tried setting up
Ruby 1.9.2, 1.9.1, 1.8.2, and 1.8.6 and can't even begin to start
developing anything.

Hello Ed:

DBI appears to be a popular way to access to ODBC in Ruby. DBI provides a
consistence way to access multiple DBs including via ODBC if you want. One
thread I read said that the Windows Ruby Installer installs DBI
automatically but it was an old thread and I haven't tried DBI myself on
Windows (I'm on Vista) so I can't confirm but maybe these links will help
you:

http://www.tutorialspoint.com/ruby/ruby_database_access.htm
http://rubyonwindows.blogspot.com/2008/01/rubygarden-archives-scripting-access.html
http://blog.hlie.org/
http://www.kitebird.com/articles/ruby-dbi.html
http://rubyonwindows.blogspot.com/2007/06/using-ruby-ado-to-work-with-ms-access.html

There is also ruby-odbc but it appears to be used along with DBI so I'm not
sure I see the point:

http://www.ch-werner.de/rubyodbc/
http://www.ruby-forum.com/topic/113835

Sorry I couldn't be more help... I haven't used Ruby for much DB stuff yet
although I did use "instant rails" to access MySQL when using the Agile Web
Development with Rails book and it was painless to setup and get going.

Michael
 
Ad

Advertisements

L

Luis Lavena

I'm trying to figure out what's so cool about Ruby. I need to create a
web app that runs on Windows 7 and talks to multiple ODBC data sources.
I wanted to start with just a simple app but I've been trying for three
days on three different machines with no success. I tried setting up
Ruby 1.9.2, 1.9.1, 1.8.2, and 1.8.6 and can't even begin to start
developing anything.

My steps have been
Uninstall and remove all existing Ruby installations
Install Ruby
install DevKit
run command gem install rails
run command gem install rake
run command gem install mysql
run command gem install mysql2
run command rails new mydbapp -d mysql
run command rails new mydbapp -d mysql2

Rails 3 (latest release of it) requires either Ruby 1.8.7 or Ruby
1.9.2. If you haven't installed one of these versions you're going to
have problems.

Second, have you read Ruby on Rails guides?

http://guides.rubyonrails.org/getting_started.html
I've tried numerous combinations of the above steps (obviously I didn't
perform both the mysql and mysql2 at the same time) and get errors on
install rails, install mysql, install mysql2, and rails new mydbapp.

If you installed RubyInstaller, there are plenty of tutorials
explaining how to get everything installed:

http://github.com/oneclick/rubyinstaller/wiki/Tutorials
I've searched the web for three days for answers to all the different
errors. I've found that many people seem to have the same or very
similar errors and it doesn't look like there's many successful
resolutions.

What errors? you're not providing the output that you're receiving so
is highly unlikely we can help you without them.

It is important also that you don't confuse Rails with Ruby.
 
E

Ed Reed

WOW! Thanks for all the responses and please accept my apologies for
venting my frustrations at 1am. You'd think I'd learn my lesson and not
do that after doing this job for so many years.

I wasn't trying to confuse Ruby and Rails and I understand that the pair
is synonymous to the pair of C++ and MFC. I guess I was just excepting
that it might be an easier way to start a new app. My reason for trying
to test with mysql was just due to my experience with it and it's
already set up on my machines for development purposes.

I will definitely take a look at the links everyone supplied.

Thanks again.
 
E

Ed Reed

Okay I've decided to start from scratch,... again. It's the start of a
new week and I've got a positive attitude so here we go. I read this,
http://www.kitebird.com/articles/ruby-dbi.html, and wanted to try the
first test script. When I do, I get the following error.

C:\PROGRA~2\APACHE~1\Apache2.2\htdocs\dbi-scripts>simple.rb
lib/rational.rb is deprecated
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles.rb:12:
warning: optional boolean argument is obsoleted
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in
load_driver': Unable to load driver 'Mysql' (underlying error:
uninitialized constant DBI::DBD::Mysql) (DBI::InterfaceError)
from C:/Ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
from
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in
`load_driver'
from
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in
`_get_full_driver'
from
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
from
C:/PROGRA~2/APACHE~1/Apache2.2/htdocs/dbi-scripts/simple.rb:9:in
`<main>'


Here are the steps I took to get to here.
Fresh install of Ruby 1.9.2 using
http://rubyforge.org/frs/download.php/72170/rubyinstaller-1.9.2-p0.exe
followed by,
gem install dbd
gem install dbi-mysql
gem install dbi-odbc
gem install mysql

There were no errors generated from any of the commands above.

Then from the command prompt I tried to run the simple.rb script from
http://www.kitebird.com/articles/ruby-dbi.html. The contents of which
are,

#!/ruby -w
# simple.rb - simple MySQL script using Ruby DBI module

require "dbi"

begin
# connect to the MySQL server
#@ _CONNECT_
dbh = DBI.connect("DBI:Mysql:test:localhost", "root", "password")
#@ _CONNECT_
# get server version string and display it
row = dbh.select_one("SELECT VERSION()")
puts "Server version: " + row[0]
#@ _EXCEPTION_
rescue DBI::DatabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
#@ _EXCEPTION_
ensure
# disconnect from server
dbh.disconnect if dbh
end

I'm open to suggestions?
 
J

Jeremy Bopp

Okay I've decided to start from scratch,... again. It's the start of a
new week and I've got a positive attitude so here we go. I read this,
http://www.kitebird.com/articles/ruby-dbi.html, and wanted to try the
first test script. When I do, I get the following error.

C:\PROGRA~2\APACHE~1\Apache2.2\htdocs\dbi-scripts>simple.rb
lib/rational.rb is deprecated
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles.rb:12:
warning: optional boolean argument is obsoleted
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in
load_driver': Unable to load driver 'Mysql' (underlying error:
uninitialized constant DBI::DBD::Mysql) (DBI::InterfaceError)
from C:/Ruby/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
from
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in
`load_driver'
from
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in
`_get_full_driver'
from
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
from
C:/PROGRA~2/APACHE~1/Apache2.2/htdocs/dbi-scripts/simple.rb:9:in
`<main>'


Here are the steps I took to get to here.
Fresh install of Ruby 1.9.2 using
http://rubyforge.org/frs/download.php/72170/rubyinstaller-1.9.2-p0.exe
followed by,
gem install dbd
gem install dbi-mysql
gem install dbi-odbc

The above gem commands have typos. They should be:

gem install dbi
gem install dbd-mysql
gem install dbd-odbc
gem install mysql

This is fetched automatically when installing the dbd-mysql gem. FYI.
Then from the command prompt I tried to run the simple.rb script from
http://www.kitebird.com/articles/ruby-dbi.html. The contents of which
are,

#!/ruby -w
# simple.rb - simple MySQL script using Ruby DBI module

require "dbi"

begin
# connect to the MySQL server
#@ _CONNECT_
dbh = DBI.connect("DBI:Mysql:test:localhost", "root", "password")
#@ _CONNECT_
# get server version string and display it
row = dbh.select_one("SELECT VERSION()")
puts "Server version: " + row[0]
#@ _EXCEPTION_
rescue DBI::DatabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
#@ _EXCEPTION_
ensure
# disconnect from server
dbh.disconnect if dbh
end

I'm open to suggestions?

It's necessary to download the MySQL client DLL and copy it into Ruby's
bin directory if you want to use the mysql gem on Windows. I downloaded
mysql-connector-c-noinstall-6.0.2-win32.zip from
http://dev.mysql.com/downloads/connector/c/ and copied the
lib/libmysql.dll file from the archive directly into Ruby's bin
directory to resolve this issue.

FYI, things are much easier under Linux. :) I wonder if it's possible
for the mysql gem for Windows builds to provide this DLL.

-Jeremy
 
E

Ed Reed

My mistake on the gem commands. I did use the correct ones with dbd
instead of dbi. I copied the libmySQL.dll and the simple.rb script now
runs correctly. Thanks! I don't have much to say about the platform. The
client says it needs to run on Windows 7 so I do what I can to meet
their expectations.
I tried another example from the same kitebird.com source. The xml.rb
script produces an error that seems to indicate a bug in the either ruby
or the extensions. I don't know if I'm still missing something or is
there really a problem that needs to be fixed.

Here's the output from the command,

C:\PROGRA~2\APACHE~1\Apache2.2\htdocs\dbi-scripts>xml.rb
lib/rational.rb is deprecated
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles.rb:12:
warning: optional boolean argument is obsoleted
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:
[BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

-- control frame ----------
c:0011 p:---- s:0051 b:0051 l:000050 d:000050 CFUNC :fetch_fields
c:0010 p:0093 s:0048 b:0048 l:000047 d:000047 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130
c:0009 p:0040 s:0040 b:0040 l:000034 d:000039 BLOCK
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:37
c:0008 p:0019 s:0038 b:0038 l:000037 d:000037 METHOD
<internal:prelude>:10
c:0007 p:0029 s:0035 b:0035 l:000034 d:000034 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:34
c:0006 p:0038 s:0030 b:0030 l:000029 d:000029 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/base_classes/database.rb:96
c:0005 p:0080 s:0024 b:0023 l:000022 d:000022 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:81
c:0004 p:0032 s:0017 b:0017 l:000016 d:000016 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:128
c:0003 p:0106 s:0010 b:0009 l:000714 d:000ca8 EVAL
C:/PROGRA~2/APACHE~1/Apache2.2/htdocs/dbi-scripts/xml.rb:24
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000714 d:000714 TOP
---------------------------
-- Ruby level backtrace information
----------------------------------------
C:/PROGRA~2/APACHE~1/Apache2.2/htdocs/dbi-scripts/xml.rb:24:in `<main>'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:128:in
`select_all'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:81:in
`execute'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/base_classes/database.rb:96:in
`execute'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:34:in
`execute'
<internal:prelude>:10:in `synchronize'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:37:in
`block in execute'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:in
`column_info'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:in
`fetch_fields'

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.
 
Ad

Advertisements

J

Jeremy Bopp

My mistake on the gem commands. I did use the correct ones with dbd
instead of dbi. I copied the libmySQL.dll and the simple.rb script now
runs correctly. Thanks! I don't have much to say about the platform. The
client says it needs to run on Windows 7 so I do what I can to meet
their expectations.

It's good you made it a little further but too bad your client got sold
on the MS koolaid.
I tried another example from the same kitebird.com source. The xml.rb
script produces an error that seems to indicate a bug in the either ruby
or the extensions. I don't know if I'm still missing something or is
there really a problem that needs to be fixed.

Here's the output from the command,

C:\PROGRA~2\APACHE~1\Apache2.2\htdocs\dbi-scripts>xml.rb
lib/rational.rb is deprecated
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles.rb:12:
warning: optional boolean argument is obsoleted
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:
[BUG] Segmentation fault
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

-- control frame ----------
c:0011 p:---- s:0051 b:0051 l:000050 d:000050 CFUNC :fetch_fields
c:0010 p:0093 s:0048 b:0048 l:000047 d:000047 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130
c:0009 p:0040 s:0040 b:0040 l:000034 d:000039 BLOCK
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:37
c:0008 p:0019 s:0038 b:0038 l:000037 d:000037 METHOD
<internal:prelude>:10
c:0007 p:0029 s:0035 b:0035 l:000034 d:000034 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:34
c:0006 p:0038 s:0030 b:0030 l:000029 d:000029 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/base_classes/database.rb:96
c:0005 p:0080 s:0024 b:0023 l:000022 d:000022 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:81
c:0004 p:0032 s:0017 b:0017 l:000016 d:000016 METHOD
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:128
c:0003 p:0106 s:0010 b:0009 l:000714 d:000ca8 EVAL
C:/PROGRA~2/APACHE~1/Apache2.2/htdocs/dbi-scripts/xml.rb:24
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:000714 d:000714 TOP
---------------------------
-- Ruby level backtrace information
----------------------------------------
C:/PROGRA~2/APACHE~1/Apache2.2/htdocs/dbi-scripts/xml.rb:24:in `<main>'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:128:in
`select_all'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/handles/database.rb:81:in
`execute'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi/base_classes/database.rb:96:in
`execute'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:34:in
`execute'
<internal:prelude>:10:in `synchronize'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:37:in
`block in execute'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:in
`column_info'
C:/Ruby/lib/ruby/gems/1.9.1/gems/dbd-mysql-0.4.4/lib/dbd/mysql/statement.rb:130:in
`fetch_fields'

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


This application has requested the Runtime to terminate it in an unusual
way.
Please contact the application's support team for more information.

My best guess on this is that the mysql gem was compiled against a
different version of the libmysql.dll file. As a result, it may make a
call somewhere that leads to a segfault. I think there might be a lead
in the mysql gem documentation:

http://rubydoc.info/gems/mysql/2.8.1/frames

It mentions that there is a History.txt file available somewhere that
has the major and version number for the MySQL client library used to
build the mysql gem. I don't have my work system available right now to
look for the file, but see if you can find it in your gem installation.

-Jeremy
 
E

Ed Reed

The history.txt file for the mysql gem says
"Binary version built against MySQL 5.0.83"
Also it shows a release date of 2009/08/21.

Is there nothing newer than this? An extension over a year old for a
bleeding-edge technology like Ruby seems a little embarrassing to me. I
looked around, I can't even find the MySQL Connector/C v5.0.83 to try
and solve the problem.

What am I missing here? This goes back to my original question. Where is
all the hype coming from? I was writing CGI apps for Windows using VB6
over 15 years ago and even back then it was a lot easier than this. I'm
willing to get on board but how much non-billable time does a person
have to spend on this stuff?
 
L

Luis Lavena

The history.txt file for the mysql gem says
"Binary version built against MySQL 5.0.83"
Also it shows a release date of 2009/08/21.

Is there nothing newer than this? An extension over a year old for a
bleeding-edge technology like Ruby seems a little embarrassing to me. I
looked around, I can't even find the MySQL Connector/C v5.0.83 to try
and solve the problem.

There has been no updates to mysql "gem" because the extension author
(the C code the gem wraps for Ruby users) hasn't been updated since
last year.

The reason for that: author declared it dead long ago. He invested
time in ruby/mysql extension instead:

http://github.com/tmtm/ruby-mysql
What am I missing here? This goes back to my original question. Where is
all the hype coming from? I was writing CGI apps for Windows using VB6
over 15 years ago and even back then it was a lot easier than this. I'm
willing to get on board but how much non-billable time does a person
have to spend on this stuff?

Seems to me you started on this with the wrong foot. Learn a framework
and a language at the same time is a daunting task that requires
patience and time.

If you, your client or your company are willing to invest on that no
matter -- what framework or language we are talking about -- will be
considered a waste of time.
 
D

Dave Howell

What am I missing here? This goes back to my original question. Where = is=20
all the hype coming from? I was writing CGI apps for Windows using VB6=20=
over 15 years ago and even back then it was a lot easier than this. = I'm=20
willing to get on board but how much non-billable time does a person=20=
have to spend on this stuff?

I sympathize. I actually decided to learn Ruby just a few months after =
Rails was first released, so I've been programming in Ruby for years. =
However, I've been using it for OS apps, not web apps. Earlier this =
year, I finally had a chance to do some web dev, and I rubbed my hands =
together. "Oh, boy, I finally get to use Rails! I've heard it's really =
fabulous! This ought to be really fun!"

Alas, no, it was really quite a nightmare.=20

Part of the problem is that once upon a time, middleware was =
comprehensive. Active Server Pages or Tango or SilverStream or =
WebObjects, by necessity, had to include everything you needed to go =
from database to web server. With Tango (the platform I used heavily =
back in the mid '90s), I needed a working ODBC connection to my database =
(SQLServer), and a web server (IIS or WebStar), and Tango. That's it.=20

Now, everything comes in pieces, and you have to snap it together =
yourself, and there's just so much more opportunity for things to not =
fit together correctly.=20

My current web-app environment is PostgreSQL for the database, Apache =
&/or Mongrel &/or WeBrick for the web server (I really don't understand =
that part yet). The ODBC driver has been replaced with some postgres =
libraries and the pg gem. Tango has been replaced with =
Ramaze&Sequel&(mumble). "Mumble" was originally HAML, but in the end I =
just scrapped the entire idea of using a templating engine because I =
couldn't stand the limitations, so now (mumble) is some custom code I =
wrote for myself.=20

I don't think this relates to your problem, but just to give you an =
example of what can go wrong: I already had a working PostgreSQL server =
to connect with, but when I tried to install the 'pg' gem so that Ruby =
could communicate with it, the gem refused to compile because it needed =
to link with some Postgres library files. Well, I *had* a local copy of =
Postgres. So I patiently explained to the gem where it *ought* to be =
looking.=20

Once it had installed, then I tried to use it. No joy there: it was =
completely broken. It took me about three days to finally fix the =
problem. I'd installed Postgres under Mac OSX 10.4, but now I was =
running 10.6, and Apple introduced huge quantities of 64-bit code with =
10.6. The pg gem had been entirely uninterested in installing itself as =
a 'universal' build, and since it was trying to be 64-bit only, it was =
unable to link to the libraries. When I 'fixed' it, which meant making =
it build as a 32-bit app, then all my OTHER gems were broken, since I =
was now trying to mix different architectures. I eventually managed to =
get Postgres correctly rebuilt in a true multi-architecture format, but =
I wrote at least three email messages far angrier than yours sounded. (I =
just didn't actually send them to anybody. {chuckle})

I then spent yet another whole day trying to get Rails to work. I'd =
heard such glowing praise for Rails that it took me that long to realize =
that it was utterly unsuitable for my web app. This roadblock of mine =
might apply to you as well. I had a very clear idea of what I expected =
DB<->web middleware to do, and Rails just plain didn't do it. I spent =
more time figuring out what the current buzzwords were that matched the =
behavior I wanted, pulling down and installing alternatives, and seeing =
if they worked more like I expected they ought. I looked at IOWA, =
SeaSide, Sinatra, Ramaze, and Padrino, among others. I looked at Sequel, =
ActiveRecord, and at least two other ORMs (after figuring out what the =
heck an ORM was in the first place and why I would care).=20

If somebody is young, and doesn't really have a strong background in =
developing for the web, and also doesn't have any kind of pre-existing =
requirements, then there's a fairly good chance that the Ruby-based =
tools will dazzle them. One of the buzzwords that really threw me for a =
while was "legacy." I needed to find an ORM that had strong support for =
legacy databases. Mind you, I am developing a brand-new application, and =
I can create any sort of schema in my database that I want, which is why =
it took me so long to figure out that "legacy" was an important buzzword =
for me. Because the apps I'm building are all about the data.=20

The usual example included with many of these new tools is a =
quick-and-easy blogging site of some kind. Blogs have super-simple data =
structures. My apps have industrial-strength data structures, and there =
is not a single ORM out there that can handle them. (By declaring my db =
schema read-only, I've been able to extend Sequel enough to get the job =
done.)=20

It sounds like Windows7 is serving the same function for you that my =
data structures did for me. It is possible to get everything running on =
W7, I'm sure, but as others have already suggested, it's much more =
problem-prone than the alternatives, so you have to ignore all the =
chirpy happy voices all over the web that promise you can have a web app =
go from concept to launch in a weekend. That happens only under ideal =
circumstances, and one of the requirements is a lack of pre-conceived =
notions, which I think you, like myself, have.=20

"How much non-billable time does a person have to spend on this stuff?" =
I think, all told, I've had to spend about two weeks. I'm still not =
sure, because I've still got one or two really exasperating malfunctions =
that I haven't fixed. Either I have to make Ramaze quit playing around =
with this stupid Mongrel gizmo and hook directly into Apache, so I can =
put muliple websites on the same (*$*)%&@#@ port, by which I mean, port =
EIGHTY!, or Mongrel (or Ramaze, or Innate, or maybe WeBrick, I really =
haven't a clue whose fault this is) has to quit f**king up my redirect =
URLs by sticking :7000 at the end, which contaminates the proxy/reverse =
proxy URL rewrites and causes the redirect to fail. Grrrrrrr!=20

However, with all that being said, I definitely feel that I'm going to =
save more than two weeks of programming time in the long run. (Whether I =
can sneak the savings into a billable form is another matter.) I can now =
create and edit web pages that contain forms for editing data from my =
database with great ease, even when the form contains multiple rows of =
data that are connected to the main table data via a many-to-many =
linking table, all of which have to be editable on the same form and =
written back to the database. Even though I've had to write my own code =
to do some of the functions that used to be handled by my old middleware =
tools, I still expect the total amount of code I'll have to write to be =
about half of what it would have been with the old tool.=20

In short, yea, at least for me, it was definitely worth it, even though =
the amount of time it took to get the tools actually operational was =
far, far longer than I'd been led to believe.=20

By the way, I did eventually post a message not unlike your first one, =
and I also got back a lot of useful suggestions and advice despite the =
fact that I probably should have gotten kicked in the shins instead. =
{grin} I would suggest you might want to try what in the end really =
worked for me: Describe what you want to DO, not which tools you've =
tried to get to work, and let people suggest potential tools for you to =
consider. (There are, for example, at least three different Ruby-to-
Postgres libraries, one of which is extinct, but not obviously so. It =
sounds like one of the MySQL gems is similar.) There might be an =
all-in-one installer available, or somebody might describe some simple =
virtualization scheme that you could use to get something up and running =
well enough to evaluate it. If you like it, then recreating it under =
Windows7 might be easier, since you'd at least know how it was supposed =
to look if it's working correctly.=20

Tap the hive mind, and save yourself a lot of frustration. Because I =
absolutely concur that there's a LOT of frustration lying in wait for =
the unsuspecting developer.=20
 
C

Charles Roper

Now, everything comes in pieces, and you have to snap it together yourself, and there's just so much more opportunity for things to not fit together correctly.

Rails originally started out as being (very) opinionated (not so much
nowadays, esp. since v3). You used the stack it provided and built
your app in a certain way. That has changed quite a bit now, but much
of it still applies. That's where the thing about 'legacy' databases
comes from. If you're using a database that doesn't fit the Rails
mould it's most likely to be an old, legacy database. If you
intentionally don't use the Rails mould and create a db in *your*
mould, then there's not a lot of point in using Rails because its
strength is in its opionionatedness and it's probably worth
investigating the alternatives.

This interview with DHH gives some insight into this thinking:

http://www.oreillynet.com/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html

Charles
 
Ad

Advertisements

E

Ed Reed

Thanks for the extensive reply Dave. I certainly appreciate it.

I spent a lot of time last night looking at all the pieces that need to
be 'snapped together' to get, what I think should be, a simple db cgi
app to work and I just can't figure out how it can be worth it. I
appreciate your's and everyone else's sentiments but I need to create a
working project that is stable and supportable. It needs to work with
databases where a Ruby api will never exist for them, because they're
not mainstream enough. I would like to test it against other more
mainstream dbs though, so a project like dbi with odbc seems
appropriate. But, I also need to be sure, when the client comes to me
after only six months needing an update, that one of those 'snapins'
isn't gonna be considered a 'dead project'. I don't see how people can
work like this. It's unacceptable to say that Windows is a difficult
development platform. Over 90% of all businesses are small businesses
and most small businesses don't have the budget or knowledge to setup
and maintain a linux backend. I don't wanna get into an OS war here,
there's no point to it. Small businesses use Windows, period. 90% is a
number that is too huge to ignore.

I will do as you suggest and explain what I'm trying to do instead of
talking about what I've done and maybe I'll get some suggestions. At
this moment though, I think Ruby and I are a 'dead project'

Thanks again to everyone.
 
B

Brian Candler

Ed said:
I spent a lot of time last night looking at all the pieces that need to
be 'snapped together' to get, what I think should be, a simple db cgi
app to work and I just can't figure out how it can be worth it. I
appreciate your's and everyone else's sentiments but I need to create a
working project that is stable and supportable.

That, to me, is the *benefit* of going with the Rails opinionated
design. Any other Rails developer who comes along to your project in 6
months time will have a head-start on how your code is structured. But I
guess you could say the same about any application design environment.
It needs to work with
databases where a Ruby api will never exist for them, because they're
not mainstream enough.

But they do have an ODBC connector? Then I'd have thought that ruby-odbc
should work, and there's a standard plugin
(activerecord-sqlserver-adapter)
It's unacceptable to say that Windows is a difficult
development platform.

Well I'm sorry, but it is. It's a total pain. Stuff which is just a
"./configure && make" away in Linux is an absolute nightmare to get
working under Windows.
Over 90% of all businesses are small businesses
and most small businesses don't have the budget or knowledge to setup
and maintain a linux backend. I don't wanna get into an OS war here,
there's no point to it. Small businesses use Windows, period. 90% is a
number that is too huge to ignore.

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Nobody on this list is really going to give you a hard sell on Rails,
because this is not a Rails mailing list anyway :) And finding a
technology which you are comfortable with is obviously a choice which
depends on your particular circumstances.

Regards,

Brian.
 
D

David Masover

My current web-app environment is PostgreSQL for the database, Apache &/or
Mongrel &/or WeBrick for the web server (I really don't understand that
part yet). The ODBC driver has been replaced with some postgres libraries
and the pg gem. Tango has been replaced with Ramaze&Sequel&(mumble).
"Mumble" was originally HAML, but in the end I just scrapped the entire
idea of using a templating engine because I couldn't stand the
limitations, so now (mumble) is some custom code I wrote for myself.

What limitations? I'm curious.

And, did you try Erector, or something similar? I prefer Haml, but if I was
finding it "limiting", I think that's where I'd go next.
I then spent yet another whole day trying to get Rails to work. I'd heard
such glowing praise for Rails that it took me that long to realize that it
was utterly unsuitable for my web app.

Again, I'm curious -- both about what the app was, and when this was. Rails
has come a long way.
I looked at Sequel,
ActiveRecord, and at least two other ORMs (after figuring out what the
heck an ORM was in the first place and why I would care).
DataMapper?

Either I have to make Ramaze quit playing around with this
stupid Mongrel gizmo and hook directly into Apache,

Trivial -- look into Passenger. But I'm trying to answer the "what, not how"
questions below.
so I can put muliple
websites on the same (*$*)%&@#@ port, by which I mean, port EIGHTY!

...why?

Assuming this is a requirement, the most flexible approach seems to be some
sort of reverse proxy. Apache can do it, nginx makes it simple and
lightweight, fairly trivial to just say "Any URL that starts with this gets
forwarded to this port on localhost."

The cool part is that you're then no longer tied to any one webserver, or even
any one machine.

The annoying part is that it's maybe more work than it should be to get a dev
environment setup.
or
Mongrel (or Ramaze, or Innate, or maybe WeBrick, I really haven't a clue
whose fault this is) has to quit f**king up my redirect URLs by sticking
:7000 at the end, which contaminates the proxy/reverse proxy URL rewrites

Probably Ramaze, or you. Generate relative URLs, or absolute URLs that start
with / instead of a domain, or hardcode the domain instead of detecting the
port. I don't know enough about Ramaze to know how difficult this is.

It would probably be possible to fix this at a lower level, like Rack or the
webserver itself, to fool Ramaze into thinking it's running somewhere else,
but you want the freedom to be able to tell Ramaze what kind of URLs it should
generate.
 
Ad

Advertisements

P

Paul McKibbin

[Note: parts of this message were removed to make it a legal post.]

Have you installed the mysql client software? The gem only provides bindings
to this, and without it you won't be able to connect. Since, as mentioned
elsewhere you haven't provided any of your errors, it is difficult to deduce
what is going wrong. I develop Ruby software across 3 different platforms,
including Windows, with and without Rails, and find it a rewarding
experience.

Mak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top