title: How to stop getting error report in Tomcat
body: <p>I created a JSP page to test how to connect to Oracle, I am using this code.</p>
  
  <pre><code>  String CONN_STRING = "jdbc:oracle:thin:@localhost:1521:orcl";
  
      try {
          Class.forName("oracle.jdbc.driver.OracleDriver");
      } catch (ClassNotFoundException e) {
          e.printStackTrace();
      }
      Connection conn = DriverManager.getConnection(CONN_STRING,
              "UMS", "d0801213177");
  </code></pre>
  
  <p>When something happens such as oracle is initializing or TNS is refusing to take more connection or the password of the database is changed then, I get an error report when I load my page. Which displays total connection string. If this happens when an user is using this page then my security is lost.</p>
  
  <p>So, my question is <strong>Is there any way to stop Tomcat form reporting errors?"</strong>. If there are any better way then please tell.</p>
  
  <p><strong>Follow up:</strong> If I am using a prepared statements, errors like table/view doesn't exists these types of errors are general so do I need to put each block in separate try catch blocks?</p>
  
  <h1>EDIT</h1>
  
  <p>As a beginer, I was struggling to hide the stackTrace because it was showing up my connection string, username, password too.</p>
  
  <p>Now I know I should have never written this code in JSP in the first place. Using Servlet to do this task would have been a better </p>