Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute a SQL script in DBeaver?

Tags:

dbeaver

I have a number of .sql files that I wish to execute through DBeaver. Traditional database development programmes allow the user to edit and run SQL scripts (totally or partially) in the same window, but this is not obvious with DBeaver.

When I open a .sql script some drop down boxes in the button bar appear, that seem to serve as connection selectors. But none of the connections I have defined appear in these drop down boxes. It is possible to open a SQL console on database objects in the Database Navigation view, but not on SQL scripts.

How can I execute a SQL script, totally or partially, against a particular database connection with DBeaver?

like image 282
Luís de Sousa Avatar asked Feb 02 '17 07:02

Luís de Sousa


People also ask

How do I import a script into DBeaver?

If you want to import external scripts into DBeaver workspace then you may use main menu File->Import->Scripts wizard.

How do I run a DBeaver execution plan?

You can click the rows of the execution plan to see their details (statistics) in the panels below and to the right of the plan. To reevaluate the plan, click the Reevaluate button ( ). To see the source script on which the plan is based, click the View Source button ( ).

Can I run PL SQL in DBeaver?

Re: oracle pl/sql JDBC driver provides ability to execute PL/SQL, invoke procedures, etc but it is not supported by current version of DBeaver. PL/SQL requires quite specific (non-standard) SQL statements handling.

How do I run multiple SQL statements in DBeaver?

Re: Multiple statement execution In scripts SQL statements have to be delimited by ";" symbol. This symbol in configurable in preferences. Also you can execute individual statements (ctrl+enter) if they are delimited by ; or by blank lines. At last you can select a query and execute it (ctrl+enter).


1 Answers

For larger files, the more optimally it is edit the .sql file in an external editor and then in DBeaver:

  • right-click on your DB
  • chose Tools / Execute script
  • load your .sql file
  • click Start.

This approach is generally more convenient and faster for large files.


To do this without an external editor, you must:

  • set your DB in Active datasource select
  • load your file File / Open file ...
  • run the whole script e.g. using a shortcut Alt+X.
like image 72
simhumileco Avatar answered Sep 21 '22 06:09

simhumileco