Database Connection and Query methods
Inconsistent method naming


Connection connection_db(String username, String password, String dbname, Connection c) {
void viewAll(String tableName, long startDate, long endDate, Connection c, String path) {



These methods have both different naming schemes, the top one uses all_lowercase_with_underscores, while the button user pascalCase. The latter is recommend in Java.

URL Injection using dbname


 c = DriverManager.getConnection("jdbc:postgresql://localhost:5432/"
            + dbname, username, password);



You never check for special characters in the dbname. This can cause databases containing special characters to mess up your function, especially when the database can be edited though config. Escape it using URLEncoder.encode