title: Is there a way to re-use the MySQL Db connection in Java App Engine
body: <p>I want to re-use a <code>java.sql.Connection</code> object. It is with Google App Engine so connection pooling is not an option (I think?). Normally I just create a new connection per servlet call, but now I have functions being called from the servlet and I don't want to create a new connection on each function call (unless I know it will be very fast), e.g.</p>
  
  <pre><code>    public void someServlet() { // Called from web page - speed is thus of concern
          try (Connection con = DriverManager.getConnection("connection string")) { // might be slow - want to re-use con
              // Do something with connection, e.g. run some queries
              someSQLFunction();
              someSQLFunction();
              someSQLFunction();
          } catch (SQLException e) {
              // Some error handling
          }
      }
  
      public void someSQLFunction() throws SQLException {
          // I don't want to re-create another Connection here, but use the one from the servlet.
          try (Connection con = DriverManager.getConnection("connection string")) { // might be slow - want to re-use con
              // Do something with connection, e.g. run some queries
              return;
          }
      }
  </code></pre>
  
  <p>How can I re-use the <code>Connection</code> object of the servlet within <code>someSQLFunction()</code>?</p>