Choose database to run script to


I want to run a database script file to fill a database. I use the Files view, right-click the file and click Run. I am asked what database schema I want to use, but not what database within that schema. The script results in 'No database selected' errors.

Offcourse I can add a 'use <db>' statement into the script or add the database into the Insert statements, but is there another way to archive the same thing from within the IDE? (I use mysqldump to generate the script file.)


Comment actions Permalink

Hello Chris,

For IDEA to be able to resolve unqualified database references you can update your Data Source properties to either include database name in connection settings:


Or enable resolving of unqualified names for desiered database here:


Comment actions Permalink

Thanks Andrey, the script runs fine now, when I enter the database name in the Settings/Database tab.
However, when I don't specify the database and only check Resolve unqualified reference instead, I get Unknown database errors.
The script I run looks like this:

use mydatabase;
update klanten set ais_id=1026617  where id=401   ;
update klanten set ais_id=1001450  where id=402   ;


Is this correct?


Please sign in to leave a comment.