Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Connection dbcon = null;
- try {
- Class.forName("oracle.jdbc.driver.OracleDriver");
- dbcon = DriverManager.getConnection("
- jdbc:oracle:thin:@localhost:1521:XE", "USERNAME", "PASSWORD");
- Statement st = dbcon.createStatement();
- String combo = "Select EMP_IDNUM from employees";
- ResultSet res = st.executeQuery(combo);
- while(res.next()){
- String ids = res.getString("EMP_IDNUM");
- String [] str = new String[]{ids};
- cboId = new JComboBox(str);
- }
- } catch (Exception d) {
- System.out.println(d);
- }
- String [] str = new String[]{ids};
- if(rs.getRow()>0){
- String [] str = new String[res.getRow()];
- int i=0;
- while(res.next()){
- str[i++] = res.getString("EMP_IDNUM");
- }
- }
- JComboBox jcb = new JComboBox(str);
- Vector v = new Vector();
- while(res.next()){
- String ids = res.getString("EMP_IDNUM");
- v.add(ids)
- }
- JComboBox jcb = new JComboBox(v);
- try {
- } catch (Exception d) {
- System.out.println(d);
- } finally {
- try {
- st.close()
- res.close()
- dbcon.close()
- } catch (Exception d) {
- //not important
- }
- }
Add Comment
Please, Sign In to add comment