The easiest way to access the data is to set up and adapter. You can then just get the data like you normally would in IDM. If you want to query the db using SQL, you have to write a workflow around it, and hook the workflow into the system.
If you want sample SQL workflow stuff then follow up with this post. I can clean up some oracle connection code and post it.