Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class OptionList {
- private Connection conn;
- private List<String> type_list = new ArrayList<>();
- private List<String> partid_list = new ArrayList<>();
- public OptionList() {
- //conn = null;
- //type_list = null;
- //partid_list = null;
- }
- public void listin_db() throws Exception, SQLException {
- JDBC ora = new JDBC();
- //1. open/get connection
- ora.openConnection();
- conn = ora.getConn();
- //2. Execute query
- String stmnt = " select distinct PARTID, NAME "
- + " from INVENTORY tblA "
- + " inner join( "
- + " select distinct part_no "
- + " from Status )tblB on tblA.Partid = tblB.part_no ";
- Statement statement = conn.createStatement();
- ResultSet rs = statement.executeQuery(stmnt);
- while (rs.next()) {
- type_list.add((String) rs.getString("NAME"));
- partid_list.add((String) rs.getString("PARTID"));
- }
- conn.close();
- statement.close();
- ora.closeConnection();
- }
- public List<String> getpartid_List() {
- return partid_list;
- }
- public List<String> getType_List() {
- return type_list;
- }
- public String test() {
- return "HelooWourldd!";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement