i'm using simple statement for this and one resultset object also, but When i trying to populate the values to jcombobox it raises nullpointerException even though i checked for !=null also...WHAT is the reason can any one tell me..
public void myInit()
{
try
{
//register driver
Class.forName("oracle.jdbc.driver.OracleDriver");
//establish the connection
con1 = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","virat");
if(con1!=null)
{
//create statement
st = con1.createStatement();
}
if(st!=null)
{
//execute login to get values to combobox
rs1 = st.executeQuery("select empid from employee");
}
if(rs1!=null)
{
while(rs1.next())
{
comboBox.addItem(rs1.getString(1));
}
}
}
catch(ClassNotFoundException cnf)
{
JOptionPane.showMessageDialog(null, cnf);
}
catch(SQLException se)
{
JOptionPane.showMessageDialog(null, se);
}
}