package leigh.astro.app;

import com.mchange.v2.c3p0.ComboPooledDataSource;
import leigh.astro.catalog.StellarCatalog;
import leigh.astro.db.AstroSql;

import java.beans.PropertyVetoException;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * A utility to load the {@link StellarCatalog} into SQL.
 *
 * @author Alex Leigh
 */
public class CatalogLoaderApp {
    public static void main(String[] args) throws PropertyVetoException, IOException, SQLException {
        ComboPooledDataSource ds = AstroSql.getDataSource();
        StellarCatalog cat = new StellarCatalog();

        try (Connection con = ds.getConnection()) {
            cat.writeToSql(con);
        }
    }
}
