Somewhere you will have to write your own servlet and make a JDBC call to your database and bring the list to your repository. This approach can be merged with the sample approach to load the list in the dropdown from repository further as mentioned in AEM 6.0 Forms Help | Dynamically populating drop-down lists.
Also, if you can expose the list via JSON then you can even use jquery on the form initialize to load the list in the drop-down. For this approach, you may find a lot of samples available publically. Sharing few for reference:
I think we might help you with FDM as well, I had to explore few things to get it to work but you may improvise it further.
Step 1: Have the list of values in the database in a single field. In below sample I have kept all the values I plan to populate as comma separated values 'a,b,c,d,e' .
Step 2: Create an FDM using RDBMS, make sure you add the get service here as we will use it in the form for invocation. Remove the arguments list from the model properties.
Test your service to make sure you get the response from db something like this:
Now let's move to Adaptive form:
Create an Adaptive form based on the FDM you have created earlier. Create one textfield name it textbox_0 and make it hidden. Go to root panel and create a script on initialize. You need to invoke the FDM service here and set the values coming from the response of service to the hidden field.
Once done with the above step you need to now set the value for drop-down. Go to the textfield which you made hidden earlier and on its value commit place the below script:
dropdownlist.items = this.value; // update thedropdownlist with your dropdownlist element name
Preview the form and you would see something like this now.
Yes - to create a Servlet in AEM - you need to understand how to create an OSGi bundle. I recommend that you look at this article - it will teach you how to work with Maven to generate some default files - including a Servlet and how to compile and deploy the project: