See this article - how to use a Servlet to populate a drop-down - in servlet, you can query the database:
Hope this helps.
This works only if Xtype is set to select and only for dialogs. I am looking for how to do this in a drop down field component in AEM form.
Moving this thread to AEM "Forms" topic so to have better contextual experts have a look at this.
there is a sample on our demo site with sample code
login using your facebook account
the 9th item in the carousel has a demo of populating drop down list. The demo name is cascading drop down list
you can download the package and try it