Search Results

Search found 1 results on 1 pages for 'user2297666'.

Page 1/1 | 1 

  • Check if user in a database is banned JDBC

    - by user2297666
    Using an oracle database, I need to perform a check to see if a user in my 'users' table is banned or not. The user is banned if his column 'banned' has a value of '1', '0' if he is not. I have the following working code here: public boolean banUser(String username) {//TODO check if user is banned already try { pstmnt = conn.prepareStatement("UPDATE users SET banned = 1 WHERE username = ?"); pstmnt.setString(1, username); pstmnt.execute(); logger.info("Banned User : " + username); return true; } catch ( SQLException e ) { e.getMessage(); } return false; } I'm not sure how to perform an if statement on top of a prepared statement. Any ideas?

    Read the article

1