I have GUI application with JDBC. One thread is for swing gui.
public static void main(String[] args)
    {
        SwingUtilities.invokeLater(new Runnable() {
            public void run()
            {
                try {
                    runApp();
                } catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        });
    }
After starting the program displays my data from the database in a JTable.
public List<Category> getCategory() throws SQLException
    {
        List<Category> cat = new ArrayList<Category>();
        Connection conn = Database.getInstance().getConnection();
        System.out.println(conn);
        String sql = "select id, name from kategorie";
        Statement selectStatement =  conn.createStatement();
        ResultSet results = selectStatement.executeQuery(sql);
        while(results.next())
        {
            int id = results.getInt("id");
            String name = results.getString("name");
            Category category = new Category(id, name);
            cat.add(category);
        }
        results.close();
        selectStatement.close();
        return cat;
    }
I wonder how can I add a new thread so that all database operations run in a separate thread, not this thread swing.