title: Identify SQL Query
body: <p>I am having a requirement in which I need to identify the type of SQL Query and execute it using JDBC. As SQL query will be provided at runtime so I just want to know that is there any criteria to find out whether the query is of INSERT, UPDATE, DELETE or SELECT. </p>
  
  <p>Currently I implemented it with comparing the starting query text with INSERT, UPDATE, DELETE or SELECT.</p>
  
  <pre><code>          try {                 
                  if (querytext.startsWith("insert")
                          || querytext.startsWith("INSERT")) {
                      // insert operation                     
                  } else if (querytext.startsWith("update")
                          || querytext.startsWith("UPDATE")
                          || querytext.startsWith("delete")
                          || querytext.startsWith("DELETE")) {
                      // update operation
                  } else {
                      // select operation
                  }
              } catch (SQLException e) {
  
              } catch (Exception e) {
  
              }
  </code></pre>