title: Trying to run alter session command to set session variable through JDBC
body: <p>I am trying to run an alter system command through JDBC which is required for me to run a query optimally.</p>
  
  <p>I`m not sure if I am doing it right as I am not able to see the effect of the alter session statement. How do we persist the same session in JDBC what I mean is if I use the same connection and not close it does it mean I am using the same session?
  The connection and database class are just helper classes to get a connection.</p>
  
  <pre><code>MyConnection mainDatabaseConnection = new MyConnection("jdbc:oracle:thin:@aas:111:"+tm.databaseName, "sys as sysdba", "xxx");
          Database mainDatabase = new Database(mainDatabaseConnection.getConnection());
  
          /* Fill in with data got for the main database */
          //String auditQuery = mainDatabase.generateAuditQuery(tm.schemaName, tm.tableName);
          String auditQuery = "select id, name, school, start, end from user where start&gt;'11-11-11' and start&lt;'12-12-12'";
          System.out.println(auditQuery);
          ResultSet rs = mainDatabase.runQuery("ALTER SESSION set optimizer_use_invisible_indexes = true");
  //        ResultSetMetaData md = rs.getMetaData();
  //        System.out.println(md.getColumnCount());
          rs.close();
      mainDatabase.close();
      mainDatabaseConnection.close();
  </code></pre>
  
  <p>I am not sure if the alter session command ran successfully.</p>
  
  <p>Question 2: When I run a Select query using Statement I get a resultSet. WHen I close the statement does the resultSet get closed too? So, as soon as I close the statment or connection does all the fetched data go away?</p>