Prev | Current Page 347 | Next

David Berube

"Practical Reporting with Ruby and Rails"


(ADO is one of many Microsoft technologies for accessing databases.)
Create a directory called C:\ruby\lib\ruby\site_ruby\X.Y\DBD\ADO. Replace X.Y with
the appropriate Ruby version, and if your Ruby isn??™t installed in C:\ruby, modify the path
appropriately). Grab the latest Ruby-DBI package from http://rubyforge.org/projects/
ruby-dbi (you??™ll need at least version 0.1.1), and unzip the file src/lib/dbd_ado/ADO.rb into
that directory. You??™ll need an appropriate decompression utility to unzip the tar.gz file,
such as 7-Zip (http://www.7-zip.org/).
Of course, the ability to insert data into the database isn??™t enough, You also need to
be able to retrieve the XML from the server and parse it. Let??™s use XmlSimple. As you saw
in Chapter 9, XmlSimple is a very simple XML parser designed to turn complex XML data
into a collection of hashes and arrays. (It??™s based on the Perl XML::Simple library, so if
you??™ve used that, it will be familiar.) You??™ll also need to install the rubyscript2exe gem.
Install both gems as follows:
gem install -y xml-simple rubyscript2exe
Begin by creating the data loader, as shown in Listing 12-18.


Pages:
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359