Answer the Question First
To enforce a 30‑second timeout for the production DataGrip data source, add the driver‑property loginTimeout=30 (and optionally socketTimeout=60) in the Driver tab of the data source. Enable Use connection pooling so the pool honours the property. Verify the timeout by checking the Diagnostics panel or the DataGrip log file for the loginTimeout value. For a global setting, edit the driver definition instead of each project file; all projects that use that driver will inherit the timeout.
Likely Explanation
- The production JDBC URL hides timeout parameters, so DataGrip falls back to the driver’s default (often unlimited).
- Connection pooling is disabled or the driver properties are not passed, meaning each query waits for the server’s timeout.
- SSL or firewall latency can further extend the wait, making the missing timeout more noticeable.
Confirmed Facts
- DataGrip does not expose a dedicated UI for pool timeouts; it relies on JDBC driver properties.
- When
Use connection pooling is enabled, the Driver tab’s properties are applied to every connection from that pool.
- Adding
loginTimeout and socketTimeout to the JDBC URL or Driver tab forces the driver to terminate idle or stalled connections after the specified period.
Steps for This Case
- Open DataGrip Settings →
Database → Data Sources → select the production data source.
- Check Use connection pooling (if unchecked, enable it).
- Navigate to the Driver tab.
- If the driver is already defined, click
+ to add a new property.
- Enter
loginTimeout as the name and 30 as the value.
- Optionally add
socketTimeout with a value like 60 to guard against network delays.
- Save the data source and restart DataGrip.
- Run a long‑running query or intentionally delay the server response.
- Open the
Diagnostics panel (View → Diagnostics) and confirm that the loginTimeout appears in the pool statistics. Alternatively, check idea.log for a line such as loginTimeout=30.
Applying a Global Timeout
Instead of editing each project’s .idea file, edit the driver definition itself:
- Go to
Settings → Database → Drivers.
- Select the driver used by the production data source.
- Add the
loginTimeout property as above.
- Save; all projects that reference this driver will inherit the timeout.
Verification in Logs
DataGrip writes connection‑pool statistics to idea.log (located in ~/.config/JetBrains/DataGrip/idea.log). Search for loginTimeout or socketTimeout to confirm the values being used at runtime.
Missing Diagnostic Detail
Which JDBC driver and database type are you using? The exact property names and supported timeout behaviour can vary (e.g., PostgreSQL uses loginTimeout, MySQL uses loginTimeout or socketTimeout, Oracle uses loginTimeout and connectTimeout).