Whether it is for combobox or something else, it is irrelevant. What you need is a way to read the info from the database and put them into a list (Vector).
Then you can use the data into the Vector and put wherever you want (JComboBox)

Search this forum, there are examples on how to connect to database using java.
You will need to create the connection, then use the query and the connection to create a statement and then run it to get the results.
Search this forum for examples

use jdbc to get the data ,here is an example

package com.bxshop.test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Demo1 {
	public static void main(String[] args) {
		Connection conn = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			//your jdbc driver name, it differs from various dbs
			//and this is the url
			conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
			//exxcute query
			ps = conn.prepareStatement("SELECT username, password FROM test");
			rs = ps.executeQuery();
			while(rs.next()) {
				System.out.println(rs.getString(1) + "\t" +rs.getString(2));
		} catch (ClassNotFoundException e) {
		} catch (SQLException e) {
This article has been dead for over six months. Start a new discussion instead.