title: Is it necessary to synchronize I/O operation to MySQL
body: <p>Is it necessary to synchronize input and output statements on MySQL?</p>
  
  <p>Database</p>
  
  <pre><code>   public class Database {
              private Object locker = new Object();
  
              public boolean createUser(String username, String password) {
                  synchronized (locker) {
                    //INSERT statement
  
                  }
              }
  
              public boolean isValidLoginAndPassword(String login, String password) {
                  synchronized (locker) {
                      //SELECT statement
                  }
              }
          }
  </code></pre>