title: Can't catch SQLSyntaxErrorException in Java using MyBatis
body: <p>I currently face the following problem:</p>
  
  <p>I have written a Java program that parses XML data and puts the data in a database. Because I use MyBatis, the database could be nearly every database already existing. 
  I'll just show you a piece of code and then I will explain the problem.</p>
  
  <pre><code>public void insert(SourceContent content){    
      SqlSession session = sqlSessionFactory.openSession();           
          try {
              session.insert("SourceDocument.insert", content);
              session.commit();
          }   catch (Exception e){
              e.printStackTrace();
          } finally {
              session.close();
          }           
      }
  </code></pre>
  
  <p>This is my DAO class for calling the sql statements of the MyBatis mapper file. Inserting my content (which is an instance of an java bean) wors fine, if the mapping configuration of MyBatis was done correctly. But imagine, if I rename a table in my database, then the connection fails because the configuration is wrong. Now I want to catch the upcoming error. When i use the statement like above:</p>
  
  <pre><code>catch (Exception e){
              e.printStackTrace();
          } 
  </code></pre>
  
  <p>the programm prints the right exception: ### Cause: java.sql.SQLSyntaxErrorException: ORA-00942: Tabelle oder View nicht vorhanden
  But I dont want to catch all Exception, I just want to catch the SQLSyntaxErrorException, because I want to tell the user, that the his table in the database is not available. But I just cant catch any other exceptions except of the normal Exception like seen above.
  I hope I had made it out clearly. Can anyone help me please?</p>