I would like to add to what Sumeet and Jennifer suggested. It would it make it much more simpler for you.
Write a UI type PX that runs on "Set Subject" and make SQL call. Store the results in a physical or logical attribute |attr1|. Read this attribute |attr1| in your drop-down attribute using "JavaScript" under "Source of selection options" as shown by Jennifer in screenshot earlier. Here is sample getOptions() JavaScript you can use to load values from Datasase effectively.
function getOptions(FieldContext){
var roles = FieldContext.getFieldValue("|attr1|");
return roles;
}
P.S.: Please make sure |attr1| contains pipe delimited string of options.
This way PX will do the heavy lifting and you won't have to worry about database connection handling and calling SQL from JavaScript. I hope it helps.