Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1.  
  2. Connection con;
  3. Statement st;
  4. ResultSet rs;
  5. JComboBox comboBox = new JComboBox();
  6.  
  7. try {
  8. con=DriverManager.getConnection("jdbc:mysql://localhost:3306/transmax?useSSL=false","test","test");
  9. st=con.createStatement();
  10. String s = "select * from przewodnik";
  11. rs = st.executeQuery(s);
  12. while(rs.next()){
  13. comboBox.addItem(rs.getString(4)+ " " + rs.getString(5));
  14. }
  15. } finally {
  16. st.close();
  17. rs.close();
  18. con.close();
  19. }
  20. panel.add(comboBox);
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement