Skip to content

Commit

Permalink
Removido comentarios desnecessarios
Browse files Browse the repository at this point in the history
  • Loading branch information
bayerlein committed Nov 12, 2016
1 parent 6276728 commit d4b7725
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions src/datamapper/PopulateDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ public class PopulateDB {
public static void main(String[] args) {
try {
PopulateDB.fullSetupDB("prosub", "root", "");
//PopulateDB.recreateDB("prosub", "root", "");
} catch (NonexistentEntityException ex) {
Logger.getLogger(PopulateDB.class.getName()).log(Level.SEVERE, null, ex);
LOG.severe(ex.toString());
}
}

Expand All @@ -59,24 +58,19 @@ private static void dropDB(String dbName, String username, String password) {
Class.forName("com.mysql.jdbc.Driver");

//STEP 3: Open a connection
//System.out.println("Connecting to a selected database...");
LOG.info("Connecting to a selected database...");
conn = DriverManager.getConnection(dbURL, username, password);
LOG.info("Connected database successfully...");
//System.out.println("Connected database successfully...");

//STEP 4: Execute a query
//System.out.println("Deleting database " + dbName + "...");
LOG.log(Level.INFO, "Deleting database {0}...", dbName);
stmt = conn.createStatement();

String sql = "DROP DATABASE " + dbName;
stmt.executeUpdate(sql);
LOG.info("Database deleted successfully...");
//System.out.println("Database deleted successfully...");
} catch (SQLException | ClassNotFoundException se) {
//Handle errors for JDBC
//se.printStackTrace();
LOG.info(("" + se));
} finally {
//finally block used to close resources
Expand All @@ -91,12 +85,9 @@ private static void dropDB(String dbName, String username, String password) {
conn.close();
}
} catch (SQLException se) {
//se.printStackTrace();
LOG.log(Level.INFO, "{0}", se);
}//end finally try
}//end try
//System.out.println("Finished!");
//System.out.println("========================================================================");
LOG.info("Finished!");
LOG.info("========================================================================");
}
Expand All @@ -111,24 +102,19 @@ private static void createDB(String dbName, String username, String password) {
Class.forName("com.mysql.jdbc.Driver");

//STEP 3: Open a connection
//System.out.println("Connecting to a selected database...");
LOG.info("Connecting to a selected database...");
conn = DriverManager.getConnection(dbURL, username, password);
LOG.info("Connected database successfully...");
//System.out.println("Connected database successfully...");

//STEP 4: Execute a query
//System.out.println("Creating database " + dbName + "...");
LOG.log(Level.INFO, "Creating database {0}...", dbName);
stmt = conn.createStatement();

String sql = "CREATE DATABASE " + dbName;
stmt.executeUpdate(sql);
LOG.info("Database deleted successfully...");
//System.out.println("Database deleted successfully...");
} catch (SQLException | ClassNotFoundException se) {
//Handle errors for JDBC
//se.printStackTrace();
LOG.info(("" + se));
} finally {
//finally block used to close resources
Expand All @@ -143,12 +129,9 @@ private static void createDB(String dbName, String username, String password) {
conn.close();
}
} catch (SQLException se) {
//se.printStackTrace();
LOG.info(("" + se));
}//end finally try
}//end try
//System.out.println("Finished!");
//System.out.println("========================================================================");
LOG.info("Finished!");
LOG.info("========================================================================");
}
Expand Down

0 comments on commit d4b7725

Please sign in to comment.