If you are trying to fetch data from odoo db from outside of odoo (ie. some external aplication or script) you should use xmlrpc protocol.
here is an example of xmlrpc usage: https://www.odoo.com/forum/Help-1/question/Can-someone-tell-me-how-to-create-and-write-objects-using-JSON-RPC-calls-52660#answer-53218
If you are doing it from some custom module for odoo, then you use odoo orm to fetch like:
The folowing line fill fetch all ids of records in 'some.model'.. once you have ids, fetch the records...
data_ids = self.pool.get('some.model').search(cr, uid, [])
explained:
- some.model iz actual database model (res.partner, product.product...)
- cr = database cursor
- uid = current user id
- [] - is search parameter, in this case simply take all record from 'some.model'
----> example of using simple criteria : [('name','=', something)] will search for all records that match ctireria name = something..
note: this is sytax for v7, in v8 this will work, but you can also use new syntax ( cr and uid is not needed anymore, it is already in self..)