[jpassion_web] Want to store all the filed value of the database table to a Array

2012-08-27 Thread Joseph John
Hi All I am a novice, just trying out I am trying to read all the values of the table to an array I am using the code " Statement stat = (Statement) conn.createStatement(); String SQLstring = "select * from students "; ResultSet rs = (ResultSet) stat.executeQuery(

[jpassion_web] Re: Want to store all the filed value of the database table to a Array

2012-08-27 Thread Joseph John
I am trying out this options now lsm.add(rs.getString(1) + ","+ rs.getString(2)+ "," + rs.getString(3) + "," + rs.getString(4)+ "," + rs.getString(5)); On Monday, August 27, 2012 4:02:26 PM UTC+4, Joseph John wrote: > > Hi All > I am a novice, just trying out > I am trying to read all the val

Re: [jpassion_web] Re: Want to store all the filed value of the database table to a Array

2012-08-27 Thread Pankaj Jain
Hello Joseph The better option is, create a POJO class with all the fields of database that you want, create getters and setters of the fields and make a List of this class. This way it will be easy to manage the data. Thanks Pankaj Jain On Mon, Aug 27, 2012 at 5:48 PM, Joseph John wrote: > I

Re: [jpassion_web] Re: Want to store all the filed value of the database table to a Array

2012-08-27 Thread Przemysław Golec
Check: *ResultSetMetaData rsmd = rs.*getMetaData() rsmd.*getColumnCount*() // to get the maximum index worth to check. And just like said Pankaj Jain - if you know how the students table looks like you shall create the POJO class responsible for storaging the one Student data for that. It will a

Re: [jpassion_web] Re: Want to store all the filed value of the database table to a Array

2012-08-27 Thread Joseph John
Thanks Pankaj Can I get a link for an example of this get and setter method way of using thanks On Mon, Aug 27, 2012 at 4:31 PM, Pankaj Jain wrote: > Hello Joseph > > The better option is, create a POJO class with all the fields of database > that you want, create getters and setters of the f

Re: [jpassion_web] Re: Want to store all the filed value of the database table to a Array

2012-08-27 Thread Pankaj Jain
Hi Joseph You can check the following link http://www.java2s.com/Code/Java/Collections-Data-Structure/Storeuserdefinedobjectsinarraylist.htm Thanks Pankaj Jain On Mon, Aug 27, 2012 at 6:22 PM, Joseph John wrote: > Thanks Pankaj > Can I get a link for an example of this get and setter method

Re: [jpassion_web] Re: Want to store all the filed value of the database table to a Array

2012-08-27 Thread KK
Its very simple   create the object of ResultSetMetaData and use the method getColumnCount()   cc  columncount while (rs.next()) {     for(int i=1; i wrote: From: Pankaj Jain Subject: Re: [jpassion_web] Re: Want to store all the filed value of the database table to a A