package phonebill;

import java.sql.*;
import java.util.*;

/**
 * A simple Bean encapsulating a database connection. In
 * a live environment should be replaced with a connection
 * pooling equivalent.
 */
public class PhoneDatabase
{
    private static final String url = "jdbc:mysql://localhost/test?user=testuser&password=secret";

    public PhoneDatabase()
    {
	try {
	    Class.forName("org.gjt.mm.mysql.Driver").newInstance();

	    DriverManager.getConnection(url).close();
	}
	catch (Exception e) {
	    e.printStackTrace();
	}
    }

    public Connection getConnection()
        throws SQLException
    {
	return DriverManager.getConnection(url);
    }
}
