私はSQLデータベースで同様のことをしました。データベースを操作するには、ResultSetインターフェイスを使用してクエリを実行し、Statementクラスを使用してステートメントを作成する必要があります。
public void makeCombo() throws SQLException{
public JComboBox warehouse = new JComboBox();
try{
Connection conn = Connect.getConnection();
String query = "Select ?? FROM ??";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
if (rs!=null){
while (rs.next()){
String name = rs.getString(1);
warehouse.addItem(name);
}
}
else{
System.err.println ("Empty combo");
warehouse.addItem("Empty Combo");
}
}
catch(Exception e){
e.printStackTrace();
}
}
これにより、ウェアハウスコンボにクエリの結果が入力されます。