« »
12/26/2022

IntelliJ IDEA - Import PostgreSQL connection string with Data Source from URL feature

IntelliJ IDEA does not support out of the box "Data Source from URL" import with standard PostgreSQL connection string like

postgresql://username:password@host:port/database

It sucks. Here is how to fix it:

  • File > New > Driver
  • Find "PostgreSQL" existing driver
  • Click "+" in the URL templates section to add a new url template
  • Type: "postgresql://{user}:{password}@{host}:{port}/{database}"
  • Click "OK"

Now next time you want to import a PostgreSQL connection string:

  • Open "Database" tab (or use the "find tool" window with your usual shortcut)
  • Click "+" > "Data Source from URL"
  • Past your PostgreSQL connection string, the selected driver will automatically change to "PostgreSQL"
  • Click "OK"
  • From there you may say: WAT. I don't see my username, password, port and host. That's right and it's IntelliJ IDEA default behavior... But, if you click on "URL only" next to "connection type" and switch back to "default" there you will find every connection field pre-completed
  • In "URL:" section, prefix "postgresql://" with "jbdc:"
  • In "URL:" section, remove the ":@" the "username:password" part.
  • Your good to go. Yes, it's slow and could be even faster but that's current IntelliJ limitation....
« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.