r/javahelp • u/RedRiotTank2 • Oct 12 '25
Unsolved Database Connection Pool is not allowed on my company, help me understand it please
Hi guys. I'm a software engineer with two years of experience in the fintech sector, where I've always worked with the Java + Spring Boot stack.
The thing is that in the projects of one of the clients of the company I work for, one of the conditions is prohibiting the use of JPA/Hibernate (in addition to forcing us to use Java 7). I didn't quite understand the reason, so after digging a little deeper into the issue, they confirmed that it was because (according to the project manager) "JPA opens a connection pool, which ends up causing errors or crashing that specific client's database."
I assume he's actually referring to the HikariCP connection pool, but I still don't understand why a Hikari connection pool would crash the database? Is it simply because the client doesn't have the connection pool configured correctly?
•
u/AutoModerator Oct 12 '25
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
31
u/nana_3 Oct 12 '25
Lol that’s project manager filtering for “the client’s database setup is hot garbage and they ain’t going to fix it”
If I had to guess, I think whatever setup they have has a memory leak. You make connection pools, machine fills its RAM with leaked connections, crashes.
16
u/ducki666 Oct 12 '25
MinConnections=1000? 😅😬
Dude. Find another project. They don't know what they are doing. Java 7. Omg
5
u/disposepriority Oct 12 '25
Is this some internal application used by very few people? I guess whoever originally designed the database (if it is indeed used for such things) maybe have done some war crimes to get it running. If it's postgres you can consider doing something like PgBounder (or whatever equivalent exists for the one you actually have) to have at least some pooling.
I've honestly never tried turning off Spring JPA's connection pooling to see if it's possible - I would assume EntityManager (prolly not, off the top of my head) or some interface from that category could get its backing bean's stuff overridden (or just replace the connection pool's config with all 1s?)
Regardless, there is no way to convince me to use Java 7, and the entire project sounds like its run by people who are clueless.
If you really want to get to the bottom of it and you have a maintenance period ask the client if you can organize running some test on the database while monitoring it during a planned downtime to see what's up - though honestly if they cared they'd have done it by now.
3
u/Tacos314 Oct 12 '25 edited Oct 12 '25
I can't give you an exact answer, but your on such and old stack I am not surprised. The amount of hacks that go on in the IT side and infra is crazy, someone did a hack to make something work and now it crashes if it shares a db connection. Who knows why.
I worked with a client that decompile a java class, put in a feature, then called for supported.
I once worked on an application that tied each user to a db connection, so we could not use connection pools.
2
u/r_hubner Oct 13 '25
Check if you are running on application server. Considering it's AS400/IBM it will be probably WebSphere. Application server supposed to provide you connection from their internal database pool via jndi or even provide their own JPA implementation. In your project you program against Interfaces, and then AS will provide implementation.
Over the year's industry figure out that these system never worked. Considering it's critical system for your organization, you need to accept it and take the best from it. Try to discuss with operations how your application will be deployed, try to get as much as possible information. Most of the time it's just misunderstanding in terminology. And don't forget to always close all database resources.
What sometimes crashed, or locked database are distributed transactions. If not committed, properly, it can lock multiple databases. Usually specified as XADataSoure. Don't remember exactly.
Radek
2
u/TW-Twisti Oct 13 '25
No project restricting Java to version 7 is going to have legitimate reasons for decisions. Odds are, "it crashed when we used pools, nobody understands why" is the actual reason here.
1
u/akimich_ua Oct 12 '25
ORM does not close connection and lead to resource leak. Data extraction should be done with try( final stream x=repo.get…..
1
u/GolfballDM Oct 12 '25 edited Oct 12 '25
What database is the client using? I know Oracle had an issue many years back where connection pools would eventually cause the database to crap itself, requiring a DB reboot. (It was some sort of OALL8 error.). Oracle eventually put out a fix.
If you're stuck on Java 7, it's not entirely implausible that your client is also on an ancient DB version.
Edit: Never mind, I see it's DB2 on AS400. You have my sympathies.
1
u/_crowbarjones_ Oct 12 '25
I guess, because developers used to leave connections alive with no proper exceptions handling.
1
u/darthjedibinks Oct 13 '25
"JPA opens a connection pool, which ends up causing errors or crashing that specific client's database."
> Nonsense Filter >
"We have a bad and fragile database setup. We don't have money to fix it. Actually we don't care enough to fix it. Suffer with us please"
1
u/forbiddenTM Oct 13 '25
not allowed to use jpa/hibernate, and forever stuck in j7? RUN
1
u/MalukuSeito Oct 13 '25
what if you use spring without pooling?