reset password
Author Message
se1k1h1mawar1
Posts: 121
Posted 18:36 Dec 01, 2014 |

If a student is foolish enough to accidentally remove the line that closes a connection (i.e. c.close();) and try to test the code and get below error, what is she to do (rather than testing the program on localhost)?

 

HTTP Status 500 - com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: User cs320stu?? already has more than 'max_user_connections' active connections

Also, is the if statement quoted below there because if c is null, then there's no need to close c since the connection has never been established?

 if (c != null) 
         
c.close();

Please let me know.
Thank you.

 

cysun
Posts: 2935
Posted 20:28 Dec 01, 2014 |

I've restarted the MySQL service so it should work now. Obviously you should be careful about closing connections to avoid the problem, but if it does happen, especially during lab or exam, just let me know and I'll restart the service.

And yes, if the connection is null, there's no need to close it (and you can't call c.close() anyway).

se1k1h1mawar1
Posts: 121
Posted 20:41 Dec 01, 2014 |

Thank you very much. I am very sorry to have bothered you!