Use "select ... limit 0" query to get just metadata, then use ResultSetMetaData objects to actually retrieve it. Something like this:
List<String> sqliteTableColumns(Connection connection, String tableName) {
List<String> columns = new ArrayList<>();
String sql = "select * from " + tableName + " LIMIT 0";
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery(sql);
ResultSetMetaData mrs = rs.getMetaData();
for(int i = 1; i <= mrs.getColumnCount(); i++) {
columns.add(mrs.getColumnLabel(i));
}
return columns;
}