Maria,
If you can't intercept the data and you have to pull from the database, you may want to look at our open-source project that's being used to produce GTFS-rt in Tampa, FL for HART:
https://github.com/CUTR-at-USF/HART-GTFS-realtimeGenerator/wikiWe were in a very similar scenario - we were provided the real-time data in a MS SQL Server database (from an Orbital OrbCAD system), without the ability to intercept the data before it hit the database. So, HART created a SQL View that provided the same fields used in GTFS-rt for TripUpdates and Vehicle Positions - in our Github project above, we simply poll that view every X seconds by executing this SQL statement:
SELECT [vehicle] as vehicle_id,[latitude],[longitude],[time],[delay],[speed],[bearing],[route] as route_id,
[trip] as trip_id,[stop] as stop_id,[sequence] as seq FROM h_BusEvents ORDER BY trip_id, vehicle_id, seq ASC;
...and then output the data into GTFS-rt protobuf format within an embedded Jetty server instance.
You should be able to re-use our same software, as long as you configure your database with a SQL View named "h_BusEvents" with the fields named the same as the above (and obviously configure it to point to your database server and log in with the right user/credentials, etc.). Alternately, just modify the query in the code to pull the correct fields from your database, if you can't set up a particular View in your database.
The Github wiki above has pretty extensive documentation, but feel free to ask if you have any additional questions.
Sean