Here you can find the source of deleteTableData(String tableName)
public static void deleteTableData(String tableName)
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; public class Main { public static void deleteTableData(String tableName) { try {//from ww w . ja v a2 s. co m Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/harddiskbrowser", "root", "root"); String queryDelete = " delete from " + tableName; PreparedStatement deletingStatement = con.prepareStatement(queryDelete); deletingStatement.execute(); con.close(); } catch (Exception e) { System.out.println("Exception occurred in deleteTableData()" + e); } } }