Advertisement
patrykszczur

Untitled

May 31st, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public Connection showUser() throws Exception {
  2. try {
  3.  
  4. Connection conn = (Connection) getConnection() ;
  5. String query = "SELECT * FROM user" ;
  6. java.sql.Statement stmt = conn.createStatement();
  7. ResultSet rs = stmt.executeQuery(query);
  8. System.out.println("idUser "+ " | " + "Name "+ " | " + "Surname "+ " | " + "Password "+ " | " + "Sex " + " | "+ "Mail "+ " | " + "Address "+ " | " + "phone_number");
  9. while (rs.next()){
  10. System.out.println(rs.getString("idUser") + " | " + rs.getString("Name") + " | " + rs.getString("Surname")+ " | " + rs.getString("Password")+ " | " + rs.getString("Sex")+ " | " + rs.getString("Mail")+ " | " + rs.getString("Address")+ " | " + rs.getString("Phone_Number"));
  11. }
  12. }catch (Exception e){
  13. System.out.println(e);
  14. }
  15. finally{
  16. System.out.println("\nsuccess\n");
  17. };
  18.  
  19. return null ;
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement