title: Java - JDBC executeUpdate() not working
body: <p>I am trying to insert/update/delete a row using jdbc. Inserting is working, and I only changed the query string (or <strong>insertTableSQL</strong>) By debugging, I suspect that <strong>executeUpdate()</strong> is not terminated and console does not show me any error message. (JUST BLANK)</p>
  
  <p><strong>[EDIT]</strong><br/>
  <strong>The program is stuck while executeUpate() is exeucting, meaning that I cannot even see the return value</strong></p>
  
  <p>Instead of using query string, I also tried <strong>PreparedStatement</strong> but no luck :(</p>
  
  <pre><code>String deleteRecordSQL = "DELETE mytable WHERE id = ?";
  PreparedStatement ps = dbConnection.prepareStatement(deleteRecordSQL);
  ps.setInt(1, 6);
  ps.executeUpdate();
  </code></pre>
  
  <p>Full Code:</p>
  
  <pre><code>import java.sql.DriverManager;
  import java.sql.Connection;
  import java.sql.PreparedStatement;
  import java.sql.SQLException;
  import java.sql.Statement;
  
  public class DeleteRow {
  
  private static final String DB_DRIVER = "oracle.jdbc.driver.OracleDriver";
  private static final String DB_CONNECTION = "";
  private static final String DB_USER = "";
  private static final String DB_PASSWORD = "";
  
  public static void main(String[] argv) {
  
      try {
  
          deleteRecordFromDbUserTable();
  
      } catch (SQLException e) {
  
          System.out.println(e.getMessage());
  
      }
  
  }
  
  private static void deleteRecordFromDbUserTable() throws SQLException {
  
      Connection dbConnection = null;
      Statement statement = null;
  
      try {
          dbConnection = getDBConnection();
          statement = dbConnection.createStatement();
          statement.executeUpdate("DELETE mytable WHERE id = 6");
  
          System.out.println("Record is deleted!");
  
  
      } catch (SQLException e) {
  
          System.out.println(e.getMessage());
  
      } finally {
  
          if (statement != null) {
              statement.close();
          }
  
          if (dbConnection != null) {
              dbConnection.close();
          }
  
      }
  
  }
  
  private static Connection getDBConnection() {
  
      Connection dbConnection = null;
  
      try {
  
          Class.forName(DB_DRIVER);
  
      } catch (ClassNotFoundException e) {
  
          System.out.println(e.getMessage());
  
      }
  
      try {
  
          dbConnection = DriverManager.getConnection(
                             DB_CONNECTION, DB_USER,DB_PASSWORD);
          return dbConnection;
  
      } catch (SQLException e) {
  
          System.out.println(e.getMessage());
  
      }
  
      return dbConnection;
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Any help?</p>