Ewew!!! SAP, not fun
First thing to determine is what is the database underpinning the SAP install, typically either Oracle or DB2, but if it's old, it could be something else old, Sybase ????
You'd probably have to bypass the MAXDB layer, go directly to the underlying database.
If it WERE a Sybase database by chance, then MAYBE you could get at it with ODBC and the activerecord_sqlserver_adapter, (freeTDS protocol version 4).
SAP is a tough one, the actual database is so abstracted and 'hidden'
You may want to read up here:
http://raa.ruby-lang.org/project/saprfc
Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.