> The twist is.. that if I run
>
> c:\ruby effluent.rb
>
> ... then the program runs and connects to the database Why?

Well, I do the same on Linux, without RubyScript2Exe:

 $ ruby troep.rb
 Error message:  is not a class/module

The problem (on my machine) is not caused by RubyScript2Exe.
The question is: What is the real cause? Removing the rescue
stuff might give us a hint:

 $ ruby troep.rb
 /usr/lib/ruby/1.8/dbi/dbi.rb:499:in `load_driver':  is not a
class/module (TypeError)
         from /usr/lib/ruby/1.8/dbi/dbi.rb:401:in `_get_full_driver'
         from /usr/lib/ruby/1.8/dbi/dbi.rb:381:in `connect'
         from troep.rb:9:in `doConnection'
         from troep.rb:16

A couple of "puts 'DEBUG'" in "dbi/dbi.rb" later, I found this:

 $:.each do |dir|
   path = "#{dir}/#{DBD::DIR}"
   ...
 end

This is where my situation and RubyScript2Exe come together. My
machine is missing the DBD (libdbd?) stuff. The full Ruby
installation on your machine is OK, but RubyScript2Exe doesn't
embed these directories/files, so the embedded Ruby
installation isn't complete. Even when running the generated
executable on your own machine, it simply won't work.

This means that I have to include some extra code to detect the
usage of DBI. Since I don't know anything of DBI, I need your
(plural) help...

Any ideas?

gegroet,
Erik V. - http://www.erikveen.dds.nl/