I've achieved a similar thing for JSR-286 portlets rendering Orbeon XForms. The solution I implemented uses sets a RenderRequest (the Portlet eqivalent of HTTPServletRequest) attributes so it should also work for your Servlet scenario.
I used Apache XMLBeans to create the XForm instance XML before setting it into the request attribute and delegating to Orbeon for XForms rendering using the following XML inside of my XForm:
<xforms:insert ev:event="xforms-model-construct-done" nodeset="instance('nameOfSomeXFormInstance')" origin="xxforms:get-request-attribute('requestXMLAttribute')"/>
Of course you have complete freedom in deciding how you read the data from the database and transform into the XForms instance's XML schema.
Hope this helps.
-Stian