How to specify relative path for embedded database URL in Data Source Properties?


I'm trying to configure a data source in IntelliJ to connect to a local, embedded Derby database.  The database is named "sample-db" and is located within my IDEA project.  I'm trying to create the datasource because I want to take advantage of IDEA's great database integration to give me warnings and such when writing SQL queries.  It's not the actual database created and used by my app, but rather just a clone so that I can configure the datasource.  Anyway...

In the "Database" tab of the Data Source Properties window, I've pointed the JDBC driver files at the derby.jar, and have specified the JDBC driver class to be org.apache.derby.jdbc.EmbeddedDrive.  And I can get it all to work just fine if I specify an absolute path for the database URL.  For example:


But, that's less than ideal since that path gets saved in the .ipr file and makes my project un-shareable with others.  Similarly, it works if I jar up the database directory and specify a jar in the database URL:


Same problem, though.  I really want to be able to use a path relative to the project or module.  However, no amount of trying $PROJECT_DIR$, ${PROJECT_DIR}, $MODULE_DIR$, ${MODULE_DIR} or relative paths like this make any difference--they all fail when I try Test Connection:





And so on.  Is it possible to use a relative URL?  If so, how?



Mac OS 10.8.2, IntelliJ IDEA IU-128.18, Apache Derby


There's no such option currently.
I think $PROJECT_DIR$ is a good solution. Please file a YouTrack ticket. We'll try to get it into the ucpoming 12.1 release.


Excellent!  Thanks so much, that will be a huge help.  Filed as IDEA-102603.


Please sign in to leave a comment.