Nos
Nos

Reputation: 1204

Sharing databases between projects within Intellij

I use Intellij to inspect databases, run sql, view data in tables etc. This all works fine but the only thing I am missing is the ability to define these datasources once and view them in all my projects i.e. that I can share them between other projects and not have to redefine them for new projects. Is this possible in Intellij?

Upvotes: 83

Views: 20210

Answers (8)

Andrew Koper
Andrew Koper

Reputation: 7199

In JetBrain's 2024 products, click on the following icons to export db settings to global, and then, in the new project, do all the steps but click on the import arrow icon to import. enter image description here

Upvotes: 0

ulou
ulou

Reputation: 5853

For the newer version (as of 24.07.2024) for IntelliJ IDEA in the Data Sources and Drivers choose your database, right click on it and click Make Global.

enter image description here

Upvotes: 2

Alex Santos
Alex Santos

Reputation: 131

In Intellij 2020.1, click on the Database view, then click on "Data Source Properties" (database with wrench icon). On the dialog that opens, click on "Make global", which is the 5th icon (screenshot below).

screenshot

Upvotes: 13

Yohannes Molla
Yohannes Molla

Reputation: 1

In IntelliJ 2019.3 to share connection to DB with multiple projects:

. Open Database panel . Data source Properties . Click the blueMake Global button

View this image to see where it is

Upvotes: 0

Bas Leijdekkers
Bas Leijdekkers

Reputation: 26462

Go to the Database tool window and click on the Data Source Properties button. Select the data source you want to make global. Click on the Make Global button in the tool bar above.

The Make Global button looks like this:

Make global button

Now you can use the data source from all your projects. However a global data source is not stored in the project files, so any other developers working on the same project will need to define their own data source.

Upvotes: 154

Andrey Dobrikov
Andrey Dobrikov

Reputation: 457

In IntelliJ 2019.1, 2019.2 to share connection to DB with multiple projects:

  1. Open Database panel
  2. Datasource Properties
  3. Make Global

Upvotes: 3

Keith
Keith

Reputation: 11

So how I did it on 2018.3 was to go to the Database tool window then right click on your datasource you want to copy then Database Tools -> Copy Datasource to Clipboard. In the Database window for the project you want to copy to click the + at the top left and it has an option to Import from Clipboard.

Upvotes: 1

Ena
Ena

Reputation: 3611

The Make Global button is no longer green (Intellij Ultimate 2018.02).

It's located above the datasource list, as in the (crappy) screenshot.

enter image description here

Upvotes: 30

Related Questions