Libgda
The CodeExampleGdaSelect example opens a connection, executes a SELECT query and dumps the contents of the result to the standard output.
Sereral examples are delivered within the samples/ directory of Libgda's source distribution (make sure to read the README file in each directory):
BDB/: using the GdaDataModelBdb data model and how to subclass it
DirDataModel/: using the GdaDataModelDir object
F-Spot/: and example of F-Spot database repair tool (using virtual connections)
TableCopy/: examples of how to copy table data (the database used for this is the SalesTest database)
Virtual/: virtual connection usage example
Libgda'UI extension
The CodeExampleGrid example displays a login dialog to let the user select a DSN (or declare a new one), runs a simple SELECT query and displays the contents of the returned data set in a grid, as show in the screenshot below: