Java:sql using result set type of class?

Hi
What way should I write the java code to do sql when the out come should only be a bunch of fields to be displayed in a JSF type  JSP? As opposed to a List maybe or as opposed to an ArrayList. Can I get some type example?
Thank you
coolgemAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

InteractiveMindCommented:
Am not entirely clear; could you elaborate?
coolgemAuthor Commented:
Can I get an example of a java class that does sql and places the result into some setters?
Thank you
InteractiveMindCommented:
Will the result be for just a single column, or for multiple?
Can you also expand a little on the "setters"; a particular data type?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

coolgemAuthor Commented:
single column ... string fields and a text field.
thank you
InteractiveMindCommented:
Perform the query, the result will be returned as a ResultSet instance; call this instance's getArray() method, and specify the required column as a parameter (either as an index—int, or column name—String).


// shove this stuff inside a try{} scope.

Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ) ;
Connection conn = DriverManager.getConnection( "jdbc:odbc:MyDataBase", "", "" ) ; // db, username, password

Statement st = conn.createStatement() ;

ResultSet rec = st.executeQuery( "SELECT column_name FROM table WHERE something_is_true" ) ;

String [] rows = (String [] ) rec.getArray( 1 ) ;  // 1 = the first column

st.close() ;



You now have the results in a String array, caleld 'rows'.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
coolgemAuthor Commented:
thank you very much have a great weekend!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.