Database connection management in Spring

后端 未结 5 1934
栀梦
栀梦 2021-01-21 09:25

Do we have to explicitly manage database resources when using Spring Framework.. liking closing all open connections etc?

I have read that Spring relieves developer from

5条回答
  •  时光取名叫无心
    2021-01-21 09:59

    I have read that Spring relieves developer from such boiler plate coding

    That depends which level of Spring you operate at. JdbcTemplate provides many different operations, some of which are fire-and-forget, some of which still require you to manage your JDBC resources (connections, resultsets, statements, etc) properly. The rule of thumb is that if you find yourself calling getConnection(), then at some point you need to call releaseConnection() also.

    ORA-00020: maximum number of processes (150) exceeded

    Are you using a connection pool? If so, then make sure that it isn't configured with a larger number of max connections than your database is capable of handling (150, in this case). If you're not using a connection pool, then you really, really should be.

提交回复
热议问题