简体   繁体   English

AWS Lambda中的Oracle DB连接

[英]Oracle DB Connection in AWS Lambda

I have a AWS Lambda function written using Java 8. I am establishing an oracle connection from my Lambda. 我有一个使用Java 8编写的AWS Lambda函数。我正在从我的Lambda建立oracle连接。 Should I explicitly close the connection , statement & resultsets or would it get destroyed automatically when lambda terminates? 我应该显式关闭连接,语句和结果集,还是在lambda终止时自动将其销毁?

Close your Statement and ResultSet explicitly always. 始终明确地关闭您的Statement和ResultSet。

Closing connection is about your implementation. 关闭连接与您的实现有关。 If you plan to reuse it, you can do it on your own, but keep in mind that... 如果您打算重复使用它,则可以自己做,但是请记住...

AWS Lambda function is a container (with one JVM running in it). AWS Lambda函数是一个容器(其中运行了一个JVM)。 It stays alive for some time (default is 5 min idle as I remember). 它会保持一段时间(我记得默认是5分钟的空闲时间)。

It means if next request to AWS Lambda function comes before 5 min. 这意味着对AWS Lambda函数的下一个请求是否在5分钟之前到达。 that container is going to be used again. 该容器将再次使用。

If there are no more available containers to serve AWS Lambda function new container/JVM will spin up - with new DB connection. 如果没有更多可用的容器来提供AWS Lambda功能,则新的容器/ JVM将启动-具有新的数据库连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM