title: JDBC closing a database connection
body: <p>I'm not sure how to close the database through this method of database connection, it's opens and connects successfully, I don't know if it closes when I close the GUI it's coded to </p>
  
  <pre><code> import java.sql.Connection;
      import java.sql.DriverManager;
      import java.sql.Statement;
  
      import javax.swing.JOptionPane;
  
      public class Database_link  {
          Connection connect = null;
          Statement state = null;
          public static Connection dbConnector()
          {
              try{
                  Class.forName("org.hsqldb.jdbcDriver");
                  Connection connect = DriverManager.getConnection("jdbc:hsqldb:file:C:\\Users\\Backup\\Documents\\Eclipse\\Eclipse Kelper\\com1028_workspace\\tf00082_prototype\\hsqldb\\AppDB;ifexists=true;shutdown=true",
                                      "adminTom", "password");
                  JOptionPane.showMessageDialog(null, "Connection Successful");
                  return connect;
  
                  }
              catch (Exception e) {
                      JOptionPane.showMessageDialog(null, "Failed Connection");
                      return null;
                  }
              }
  
      }
  </code></pre>