How do I tell IntelliJ to run a query on a different database?

I am using IntelliJ IDEA 13. I have a .sql file with mysql queries. I have been making requests to localhost, but now I would like to run them on my dev database server (which has the same database and tables). I didn't want to delete the localhost connection. However, whenever I press Ctrl-Enter on the sql query, IntelliJ (un) helps to reopen the connection to the localhost and runs it there. How do I tell IntelliJ to link my .sql file with the new database connection instead of the old one? I would rather not delete the old connection entirely, although I know this is a workaround.

+3


source to share


2 answers


It looks like your best bet is to go to the database console pane (usually at the bottom of the screen) and right click on the tab that displays the server / connection title (in the same pane as the minify and gear icon), close that console and try running the query again with Ctrl-Enter. At this point, a pop-up window will ask you to select the database connection to use.



+2


source


As of 2017.3.1, check the top right corner of your file window; you can select the database from there.

enter image description here



Photo taken from Jetbrain DBE-4454 report .

0


source







All Articles