Whats wrong with my code? the data from my database is not showing on my combo box..
Im trying to get my data in my database to my combo box ..
Here is my Code :
private void Fillcombo(){
Connection con = null;
String url = "jdbc:mysql://localhost:3306/";
String db = "purchasedb";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass= "ajleal";
try {
con = DriverManager.getConnection(url+db,user,pass);
Statement stmt= con.createStatement();
ResultSet rs = stmt.executeQuery( "select * from supplier");
while (rs.next()){
String name = rs.getString("supn");
jComboBox1.addItem("supn");
}
}catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}