соответствующая часть примера кода довольно проста:
Driver *driver;
Connection *con;
Statement *stmt;
ResultSet *res;
driver = get_driver_instance();
/* create a database connection using the Driver */
con = driver -> connect(url, user, password);
/* alternate syntax using auto_ptr to create the db connection */
//auto_ptr con (driver -> connect(url, user, password));
/* turn off the autocommit */
con -> setAutoCommit(0);
/* select appropriate database schema */
con -> setSchema(database);
Оттуда вам просто нужно запросить его так:
stmt = con -> createStatement();
res = stmt -> executeQuery ("SELECT * FROM City");