Question
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
// the connectionConnection conn = null;
Class.forName("oracle.jdbc.driver.OracleDriver");
// you may want to chage some infor to meet your setting
conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","app","app");
// some usual statemant
PreparedStatement psSelectRecord=null;
ResultSet rsSelectRecord=null;
String sqlSelectRecord=null;
sqlSelectRecord ="SELECT * FROM datatable";
// get all record in this object
psSelectRecord=conn.prepareStatement(sqlSelectRecord);
rsSelectRecord=psSelectRecord.executeQuery();
// we have got the data from database here
// let's put it in to an array
ArrayList<bean> rs = new ArrayList<bean>();
while(rsSelectRecord.next()){
// add new bean to array...