Closing MySql Connection in Drupal7 How can I explicitly close a MySql Connection in Drupal 7?
I have a requirement of inserting back to rows to a DB table in Drupal..
I tried using db_insert/db_update and db_query.. In both cases I got the error Max number of SQL connections reached..
I am speculating that Drupal is maintaining these connections one per query and not closing them..
Hence I need to know if there is any way I can do it explicitly.
The specific function you are looking for in the database abstraction API is db_close() but you may be able to solve your problem through another route by increasing your max connections. 

See this earlier thread on drupal.stackexchange for guidance on increasing max_connections. You might also be having a problem with slow / stalled queries that are trying up limited query slots, this thread offers advice on how to debug.