Here you can find the source of clearTables(Connection connection)
Parameter | Description |
---|---|
connection | connection to database |
Parameter | Description |
---|---|
Exception | wrap all exceptions |
public static void clearTables(Connection connection) throws Exception
//package com.java2s; import java.sql.Connection; import java.sql.Statement; public class Main { /**/* w w w .j a v a 2s . co m*/ * Deleting all data from specified table. * * @param connection connection to database * @throws Exception wrap all exceptions */ public static void clearTables(Connection connection) throws Exception { String[] tables = new String[] { "scorecard_question", "scorecard_section", "scorecard_group", "scorecard", "scorecard_status_lu", "scorecard_type_lu", "scorecard_question_type_lu", "project_category_lu" }; for (int i = 0; i < tables.length; i++) { String query = "DELETE FROM " + tables[i]; Statement statement = connection.createStatement(); statement.executeUpdate(query); } } }