NB: This email and its contents are subject to our email legal
notice
which can be viewed at http://www.sars.gov.za/Email_Disclaimer.pdf
----
I
found this on the web somewhere and played with it for a while. It connects
to the Northwind Access database, if it is set up as an ODBC data source. May
help.
require 'dbi'
begin
#dbh = DBI.connect("DBI:ODBC:database", "username", "password")
dbh = DBI.connect("DBI:ODBC:Northwind", "", "")
#get server version string and display it
row = dbh.select_one("SELECT 'Connected !'")
puts "Connected ?: " + row[0]
rescue DBI::DatabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
#disconnect from server
dbh.disconnect if dbh
end
begin
#dbh = DBI.connect("DBI:ODBC:database", "username", "password")
dbh = DBI.connect("DBI:ODBC:Northwind", "", "")
#get server version string and display it
row = dbh.select_one("SELECT 'Connected !'")
puts "Connected ?: " + row[0]
rescue DBI::DatabaseError => e
puts "An error occurred"
puts "Error code: #{e.err}"
puts "Error message: #{e.errstr}"
ensure
#disconnect from server
dbh.disconnect if dbh
end
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 06 September 2005 08:13
To: [email protected]
Subject: [Wtr-general] About the installation of DBIHi DaveI found that if I want to use the DBI I first should install the Ruby MySQL Module then install the Ruby DBI Module .But in fact I found these two tools should be installed under the Linux like system.Installation of Ruby MySQL Module :ruby extconf.rb% make
% make installInstallation of Ruby DBI Moduleruby setup.rb config
% ruby setup.rb setup
% ruby setup.rb installAs above shows the Installation of Ruby DBI Module can be executed in win32 but the Ruby MySQL Module cann't installed under windows system the system cann't recognize the 'make' command.
So what should I do if I want to use the Ruby DBI under the windows system
Thank you very much.
jim
Click here to donate to the Hurricane Katrina relief effort.
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
