question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide data source status in order to manage auto-reconnect

See original GitHub issue

Hi,

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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pietermartincommented, Apr 1, 2021

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()

0reactions
niushapakscommented, Apr 6, 2021

Hi, I’m not working on the project using sqlg anymore, but thank you for looking on it 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found