Home > front end >  DBeaver export to csv: "No database selected"
DBeaver export to csv: "No database selected"

Time:09-28

select * from users u
where u.id < 1000

When I right-click to script, and export I get no database selected error.

When I add "use db" command at above,I get a syntax error.

use db
select * from users u
where u.id < 1000

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM..'

How do I export in DBeaver? I use a MacOS, and db is using MariaDB if that matters.

CodePudding user response:

Either you have to separate multiple statements by a semicolon (1) or you can pass the database name directly to your statement (2):

(1):

use db;
select columns from users u ...

(2):

select columns from db.users u ....

CodePudding user response:

Based on your comment I understand now this is a usage question about DBeaver. You simply need to make sure to select your database in the menu bar at above the script tab as outlined here: enter image description here

enter image description here

  • Related