/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
 package br.senac.tads.pi3.agenda.agenda;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
 
 /**
  * @author Mauricio Gustavo
  * @author Leandro Rodrigues
  */
 public class Conexao {
 
     Connection conn = null;
 
     public Connection obterConexao() throws SQLException, ClassNotFoundException {
         // Passo 1: Registrar driver JDBC.
         Class.forName("org.apache.derby.jdbc.ClientDataSource");
 
         // Passo 2: Abrir a conexÃ£o
         conn = DriverManager.getConnection(
                 "jdbc:derby://localhost:1527/agendabd;SecurityMechanism=3",
                 "app", // usuario
                 "app"); // senha
         return conn;
     }
 
     public void fechaConexoes() throws SQLException {
         conn.commit();
         conn.close();
     }
 }
teste commit conexao