Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.64 KB | None | 0 0
  1. public int sizeOfLoginColumn() throws SQLException {
  2.         int size = 0;
  3.         try {
  4.             connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/usersdb?"
  5.                     + "user=root&password=");
  6.             String sql = "select count(*) from users";
  7.             Statement ps = connection.createStatement();
  8.             rsContact = ps.executeQuery(sql);
  9.                 size = rsContact.getInt(1);
  10.                 System.out.println(size);
  11.         } catch (SQLException ex) {
  12.             Logger.getLogger(DataBaseConnection.class.getName()).log(Level.SEVERE, null, ex);
  13.         }
  14.         return size;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement