Choose database to run script to

Hi,

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.)

Chris

2 comments
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:

Database_name.png

Or enable resolving of unqualified names for desiered database here:

Database_resolve.png

0
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?

0

Please sign in to leave a comment.