Sinatra has no provision for talking to databases. You can use the mysql2 gem to talk to the database, but I'd highly recommend looking at Sequel, which is a very flexible and powerful ORM, which makes it very easy to talk to legacy databases.
Look through the README, and Cheat Sheet and you'll get a good idea of how easy it is to connect to an existing database, without needing to worry about modifying it.
This is untested of course, but it's the basic steps needed to make a connection and retrieve a record from an existing database:
require 'sequel'
DB = Sequel.connect('mysql2://your_DB:credentials@host/table')
foo = DB[:serverinfo].select(:DB, :SERVERNM).where(:STATUS => 'A').first
Wrap the code above inside a get
or post
handler in Sinatra and it'll retrieve the record. Something like this would get you close:
require 'sequel'
require 'json'
DB = Sequel.connect('mysql2://your_DB:credentials@host/table')
get '/' do
content_type :json
foo = DB[:serverinfo].select(:DB, :SERVERNM).where(:STATUS => 'A').first
foo.to_json # would return the hash to the browser
end
As far as using Datamapper, read the quote at the top of Sequel's main page.