package Database;


public class DatabaseConnector {
}

@@ -17,39 +17,2994 @@
 ;%0A%0A%0A
-public class DatabaseConnector %7B
+import java.sql.Connection;%0Aimport java.sql.DriverManager;%0Aimport java.sql.SQLException;%0A%0A/**%0A * This class creates a %3Ccode%3EConnection%3C/code%3E object's database is able to provide information%0A * describing its tables, its supported SQL grammar, its stored%0A * procedures, the capabilities of this connection, and so on.%0A *%0A * @author OGUNDE KEHINDE%0A * @see DriverManager#getConnection%0A * @see java.sql.Statement%0A * @see java.sql.ResultSet%0A * @see java.sql.DatabaseMetaData%0A */%0Apublic class DatabaseConnector %7B%0A%0A    /**%0A     * %3CP%3EA connection (session) with a specific%0A     * database. SQL statements are executed and results are returned%0A     * within the context of a connection.%0A     * %3Cp/%3E%0A     */%0A    private Connection connection;%0A%0A    /**%0A     * stores universal resource locator to a database%0A     */%0A    private String url;%0A%0A    /**%0A     * stores username to a database%0A     */%0A    private String username;%0A%0A    /**%0A     * stores password to a database%0A     */%0A    private String password;%0A%0A    /**%0A     * stores a database name%0A     */%0A    private String database;%0A%0A    /**%0A     * constructs this class with the specified argument%0A     *%0A     * @param url to a database%0A     * @param username to a database%0A     * @param password to a database%0A     */%0A    public DatabaseConnector(String url, String username, String password) %7B%0A        this.url = url;%0A        this.username = username;%0A        this.password = password;%0A    %7D%0A%0A    /**%0A     * constructs this class with the specified arguments%0A     *%0A     * @param url to a database%0A     * @param username to a database%0A     * @param password to a database%0A     * @param database to a database%0A     */%0A    public DatabaseConnector(String url, String username, String password, String database) %7B%0A        this(url, username, password);%0A        this.database = database;%0A    %7D%0A%0A    /**%0A     * Try to create a database connection%0A     * if and only if this url, username and password%0A     * is not %3Ccode%3Enull%3C/code%3E.%0A     * Returns a Connection element if and only if%0A     * connection throws no errors.%0A     *%0A     * @return a connection elemet%0A     * @throws java.lang.Exception%0A     */%0A    public Connection connect() %7B%0A        try %7B%0A            Class.forName(%22com.mysql.jdbc.Driver%22);%0A            this.connection = (this.database != null) ?%0A                    DriverManager.getConnection(this.url + %22/%22 + database, this.username, this.password) :%0A                    DriverManager.getConnection(this.url, this.username, this.password);%0A        %7D catch (Exception e) %7B%0A            e.printStackTrace();%0A        %7D%0A        return connection;%0A    %7D%0A%0A    /**%0A     * Disconnect this connection if its been active%0A     *%0A     * @throws SQLException%0A     */%0A    public void disconnect() throws SQLException %7B%0A        if (connection != null)%0A            connection.close();%0A    %7D%0A%0A    public String getDatabase() %7B%0A        return this.database;%0A    %7D%0A%0A    public void setDatabase(String database) %7B%0A        this.database = database;%0A    %7D
 %0A%7D%0A

Add DatabaseConnector class