01.
public
static
Array selectAll()
throws
NamingException, SQLException{
02.
ArrayList ot =
new
ArrayList();
03.
ArrayList ot1 =
new
ArrayList();
04.
ArrayList ot2 =
new
ArrayList();
05.
String sql =
"select * from Type"
;
06.
Connection con = ConectDB.initializestock();
07.
PreparedStatement pstmt = con.prepareStatement(sql);
08.
ResultSet rs1 = pstmt.executeQuery() ;
09.
ResultSet rs2 = pstmt.executeQuery() ;
10.
while
(rs1.next()){
11.
Type b =
new
Type();
12.
b.setTypeid(rs1.getString(
"typeid"
));
13.
b.setTxt(rs1.getString(
"txt"
));
14.
ot1.add(b);
15.
}
16.
rs1.close();
17.
while
(rs2.next()){
18.
Type b =
new
Type();
19.
b.setTypeid(rs2.getString(
"typeid"
));
20.
b.setTxt(rs2.getString(
"txt"
));
21.
ot2.add(b);
22.
}
23.
rs2.close();
24.
pstmt.close();
25.
con.close();
26.
return
(Array) ot;
27.
}