G
Graham
C:\>rubyscript2exe effluent.rb
Tracing effluent ...
Gathering files...
Copying files...
Creating effluent.exe ...
C:\>effluent
Error message: is not a class/module
the being executed is:-
require 'dbi'
# check if this exists - and if so then the ruby2exe script is
satisfied and we can exit
# must be placed after the require statements
exit if defined?(REQUIRE2LIB)
# Open the connection to the database and get the handle
def doConnection
begin
dbh = DBI.connect('DBI:Oracle:tpdev', 'username', 'pwd');
rescue
puts "Error message: #{$!}"
end
return dbh # could be nil if failed to connect
end
dbh = doConnection
The twist is.. that if I run
c:\ruby effluent.rb
.... then the program runs and connects to the database
Why?
Tracing effluent ...
Gathering files...
Copying files...
Creating effluent.exe ...
C:\>effluent
Error message: is not a class/module
the being executed is:-
require 'dbi'
# check if this exists - and if so then the ruby2exe script is
satisfied and we can exit
# must be placed after the require statements
exit if defined?(REQUIRE2LIB)
# Open the connection to the database and get the handle
def doConnection
begin
dbh = DBI.connect('DBI:Oracle:tpdev', 'username', 'pwd');
rescue
puts "Error message: #{$!}"
end
return dbh # could be nil if failed to connect
end
dbh = doConnection
The twist is.. that if I run
c:\ruby effluent.rb
.... then the program runs and connects to the database
Why?