#Is there a way to change data in a stream?

5 messages · Page 1 of 1 (latest)

plush timber
#

Please tell me, I want to implement reading the database table while the thread is running, what are the ways to implement this, and is it possible at all?
I give an example:
While the program is running, it reads the field of the database table and saves them to a separate file, when adding values ​​​​to the field, it automatically saves this value to the file if the thread is running.
What did i get:

@Override
    public void run() {
        try {
            Lock lock = new ReentrantLock();
            lock.lock();

            ResultSet resultSet = connection.createStatement().executeQuery("SELECT * FROM panel");

            while (resultSet.next())
                System.out.println(resultSet.getString("id"));

            lock.newCondition().await();
        } catch (SQLException | InterruptedException exception) {
            throw new RuntimeException(exception);
        }
    }
proud ibexBOT
#

This post has been reserved for your question.

Hey @plush timber! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

proud ibexBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.

nova stream