简体   繁体   中英

Database JDBC Find out open connections/sessions?

Is there anyway we can find out the open connections at a time when doing JPA operations for example.

To be more clear, I am getting no buffer space available error. So I want to know if i can close down my connections in my code in order to avoid this error?

Or if i can monitor it using some monitor tool what is happening etc.

It is a help request, if you can help I will be thankful, if you can't help then why are you down voting? This discourages from asking for help.

In my opinion it depends on the driver that your are using, some of them could have some way to know about it. But it is posible it could be a dangerous practice, because you could close a connection that is currently used.

The best way is to use a connection pool manager that take care about all the conections for instance:

http://www.mchange.com/projects/c3p0/index.html

Or integrate your database conections into and ORM for example hibernate:

http://hibernate.org/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM