1

DBeaver uses MariaDB Connector/J, and the driver disconnects after completing the query.

We are trying to use a MariaDB feature that depends on the session, so we need to run the query and keep the session alive for another query later to gather the performance profiles.

We have a workaround:

  • highlight the SQL statements for running, then
  • run them by "Execute script", Alt + X.

However, we wonder how to keep DBeaver holding on to the same session and not disconnecting after each query.

James
  • 279
  • 1
  • 3
  • 11
  • You can't just put all the logic you need to run the statements and then some wait logic like so https://blog.sqlauthority.com/2021/11/15/mysql-wait-for-seconds-using-select-sleep/ and once that period suffices, collect the rest of the session specific and dependent data. Maybe it will need to go to a stored procedure with similar logic or perhaps whatever data is session specific, make it available outside the session. Then have the other query get the data and clean the non-temp table 'temp table perhaps `_YYYYMMDD_hhmmss`, etc. that way. – Vomit IT - Chunky Mess Style Jan 22 '23 at 05:25

1 Answers1

1

This is the way i came up with:

  1. Open new script file, this script file will only be used for keeping connection alive

  2. Execute any query, for example: select now() in this script file

  3. Next in bottom left corner click Refresh and set refresh interval, for example, 300 seconds (5 minutes)

  4. So above query will be executed every 5 minutes and will keep connection alive