Skip to content

Commit

Permalink
Melhorado o uso dos LOGs
Browse files Browse the repository at this point in the history
  • Loading branch information
bayerlein committed Nov 12, 2016
1 parent d4b7725 commit 5a9de3d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/datamapper/PopulateDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,25 @@ private static void dropDB(String dbName, String username, String password) {
String sql = "DROP DATABASE " + dbName;
stmt.executeUpdate(sql);
LOG.info("Database deleted successfully...");

} catch (SQLException | ClassNotFoundException se) {
//Handle errors for JDBC
LOG.info(("" + se));
LOG.severe(se.toString());
} finally {
//finally block used to close resources
try {
if (stmt != null) {
conn.close();
}
} catch (SQLException se) {
}// do nothing
LOG.severe(se.toString());
}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException se) {
LOG.log(Level.INFO, "{0}", se);
LOG.severe(se.toString());
}//end finally try
}//end try
LOG.info("Finished!");
Expand Down Expand Up @@ -113,23 +115,25 @@ private static void createDB(String dbName, String username, String password) {
String sql = "CREATE DATABASE " + dbName;
stmt.executeUpdate(sql);
LOG.info("Database deleted successfully...");

} catch (SQLException | ClassNotFoundException se) {
//Handle errors for JDBC
LOG.info(("" + se));
LOG.severe(se.toString());
} finally {
//finally block used to close resources
try {
if (stmt != null) {
conn.close();
}
} catch (SQLException se) {
}// do nothing
LOG.severe(se.toString());
}
try {
if (conn != null) {
conn.close();
}
} catch (SQLException se) {
LOG.info(("" + se));
LOG.severe(se.toString());
}//end finally try
}//end try
LOG.info("Finished!");
Expand Down

0 comments on commit 5a9de3d

Please sign in to comment.