Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

(need help) my aplication not error but why not working ?

936150May 9 2012 — edited May 14 2012
i want load data to combobox from database,and this is my code....no error but why not working ?




private void BoxhobyActionPerformed(java.awt.event.ActionEvent evt) {
try {
String dbname="jdbc:odbc:gaji";//nama odbc
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection(dbname,"admin","admin");//user & pasword
String sql = "select pekerjaan from gaji order by pekerjaan";
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery(sql);
while (rs.next())
{
Boxhoby.addItem(""+rs.getString("pekerjaan"));
}

statement.close();

con.close();
}catch(Exception x)
{
JOptionPane.showMessageDialog(null,"error:"+x,"gagal",JOptionPane.WARNING_MESSAGE);

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 11 2012
Added on May 9 2012
6 comments
2,925 views