posted 14 years ago
Hi all.
I am getting java.lang.UnsupportedOperationException while storing the data into arraylist from database.
My code is....
public List displayNotice() throws SQLException, ClassNotFoundException
{
Class.forName("com.mysql.jdbc.Driver");
Connection con1=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase","root","root");
Statement st=con1.createStatement();
ResultSet rs=st.executeQuery("select noticedate, notice from mytable");
while(rs.next())
{
Notice note = new Notice();
note.setToday(rs.getString(1));
note.setEditor(rs.getString(2));
try
{
arrList.add(note);
}catch(Exception e)
{
e.printStackTrace();
}
return arrList;
}
It showing the above exception for add() fuction, due to which I am not able to get the data from database.
Help Please...