Mysqli too many connections

Silverstripe Version:4.9

Question:

Hi, I have created a connection to a separate database and I am pulling data from an existing SQL Server DB, using a similar method to the link below.

https://forumarchive.silverstripe.org/community/forums/customising-the-cms/show/13692

Everything is working fine, until one time I refresh the page and get a mysqli too many connections error. I understand that I need to close the connections usually done with mysqli_close, but is this done using the same way in Silverstripe?

Thank you.

Could you maybe post a bit of the relevant code for what you’ve done. That will help people provide some suggestions.