Provide data source status in order to manage auto-reconnect
See original GitHub issueHi,
We encountered a disconnection issue with our PostgreSQL database, after our application was running during several hours.
In order to re-open the connection in these cases, we used reflection to check the status of the closed private field of the C3P0DataSource class :
Field closedField = C3P0DataSource.class.getDeclaredField("closed");
closedField.setAccessible(true);
AtomicBoolean closed = (AtomicBoolean)closedField.get(graph.getSqlgDataSource());
if(closed.get()) {
graph = SqlgGraph.open(graphConfiguration.getConfiguration());
}
When I close manually the connection, this field is correctly updated and I am able to re-open it, but as this is a private field I am not confident using it and don’t know if it will be reliable in case of random connection loose.
Is that field reliable for our needs ? If so, is it possible to provide it with a public accessor ?
If no, is there any auto-reconnect mechanism available ? Or is it possible to provide some ?
Thank you very much
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
WebSphere Application Server data source properties - IBM
Use this page to set advanced data source properties in the application server. These properties activate and configure services that the ...
Read more >Spring Boot JPA - configuring auto reconnect - Stack Overflow
Do I need to provide this configuration for both the datasource like spring.datasource.mydatasource1.tomcat.testOnBorrow=true spring.datasource.mydatasource1.
Read more >10 Tuning Data Source Connection Pools - Oracle Help Center
This chapter provides information on how to properly tune the connection pool attributes in JDBC data sources in your WebLogic Server 10.3.6 domain...
Read more >Error "Reconnect To..." When Attempting to Refresh a ...
Once a connection is re-established in Tableau Cloud to the database, using the Refresh from Source option may work again in Tableau Desktop....
Read more >Why is my Data Source disconnected? - Databox Help Desk
How to resolve this error. In Databox, navigate to Data Sources and click the Reconnect button to reconnect your disconnected Data Source.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not sure if you are still interested in this. C3P0 pool has a jmx interface that one can check and call operations on. I tested resetting the pool from there and it works fine. I am adding some code to make the data source’s name readable.
Sqlg also makes some stats available via json.
sqlgGraph.getSqlgDataSource().getPoolStatsAsJson()
Hi, I’m not working on the project using sqlg anymore, but thank you for looking on it 👍