Can I add databases to a module and include it in multiple projects?

I have a handful of databases that are shared between applications.  I wonder if it is possible to connect to the database in a module, then add the module to each project, such that the database connections are available in every project that uses them.  Or is there another, recommended way of doing this so that I don't have to setup those connection details every time?

2 comments
Comment actions Permalink

Yes. When you create or edit a Data Source definition, you can set it's scope as either "Project" or "IDE" via a drop down in the upper right corner. To share across projects, set it to IDE.

ss.png

0
Comment actions Permalink

p.s. if you only want to share with selected projects rather than all projects, you can keep it as Project scope. Then copy the dataSources.xml, dataSources.ids and (if present) dataSources.local.xml files from the project's .idea directory into the other project's .idea directory. Then close and reopen the target project(s). Keep in mind that they will then be individual definitions (and not-linked unless you use symbolic links or such). So if you want to edit them, you will need to edit each one (or edit one and then recopy it).

0

Please sign in to leave a comment.