You can create data connections in InfoPath via the wizard.
To query and submit a database you can either connect via ODC connection, but you are limited to one set of related tables which you can query and submit to.
Or you can use web services, then you have no limitations. I would recommend you check out the Database Accelerator web services suite. It provides everything you need and you can download and test it.
Database Accelerator (DBXL) v2.3 Pre-Release