Where does IntelliJ IDEA store database console scripts?

Try looking into the IntelliJ cache folder.

For me I did not find the database scripts themselves, but found a history of all the sql statements executed here :

`c:\Users\$user\.IntelliJIdea13\system\userHistory\*.xml`

(Am on IntelliJ Idea EAP).


If you are on Mac OS X, and as of IntelliJ IDEA 14, this gets stored here:

~/Library/Caches/IntelliJIdea14/userHistory/*.xml

I suspect that OS X updates sometimes clear ~/Library/Caches, because after the OS X 10.10.2 update I lost my database console history. If the contents of your database console are important to you, make sure you are backing up this folder and not excluding it in your Time Machine backup!

Update (2016/09/23): At some point they moved it out of Caches and into the preferences folder, which is good because you no longer have to worry about macOS updates wiping it out. For example, it is here in the current version:

~/Library/Preferences/IntelliJIdea2016.2/consoles/db/