简体   繁体   English

Java Lambda Function 在连接到 Informix DB 时超时

[英]Java Lambda Function is getting timed out while connecting to Informix DB

I have a lambda function written in Java .我有一个 lambda function 写在Java中。 I have written database connection logic in lambda function.我在lambda function中写了数据库连接逻辑。 My database is Informix DB, which is outside AWS.我的数据库是 Informix DB,它在 AWS 之外。 Whenever, lambda runs and try to connect to DB, it gets time-out every-time.每当 lambda 运行并尝试连接到数据库时,它每次都会超时。 Can we connect to database outside AWS via lambda function?我们可以通过 lambda function 连接到 AWS 外部的数据库吗?

  1. Check that your Lambda actually can access resources outside the AWS, if it uses VPC.检查您的 Lambda 是否真的可以访问 AWS 外部的资源,如果它使用 VPC。
  2. If you're sure it can access external resources – increase Lambda timeout, which is 15 seconds by default.如果您确定它可以访问外部资源 - 增加 Lambda 超时,默认为 15 秒。 BTW, Java-based Lambda functions experience cold starts up to a few seconds.顺便说一句,基于 Java 的 Lambda 函数会经历长达几秒钟的冷启动。 Current maximum execution time (timeout) for a Lambda function is 15 minutes. Lambda function 的当前最大执行时间(超时)为 15 分钟。

Issue is Resolved!!问题已解决!!

We were using hostname in our DB connection string.我们在数据库连接字符串中使用了主机名。 We now are using IP address and it is connecting now.我们现在使用的是 IP 地址,它现在正在连接。

connectionString = jdbc:informix-sqli://<IP Address>/xxx:xxx

Thanks @madhead, @Chris Williams and all others for sharing their ideas.感谢@madhead、@Chris Williams 和所有其他人分享他们的想法。 It really helped.它真的很有帮助。

暂无
暂无

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

相关问题 获取“ java.net.SocketTimeoutException:连接到AWS EC2上托管的mongo db时,连接超时 - Getting “java.net.SocketTimeoutException: connect timed out ,when connecting to mongo db hosted on aws EC2 java.net.ConnectException:通过代理连接时连接超时 - java.net.ConnectException: Connection timed out while connecting through a proxy 通过Java中的套接字在同一网络上连接两个系统时,连接超时 - Connection Timed out while connecting two systems on same network via sockets in java AWS Lambda:任务超时 - AWS Lambda: Task timed out 在Weblogic中共享HTTP会话时,会话超时 - Session is getting timed out while HTTP session is share in weblogic 从 Zookeeper 获取错误 意外异常导致关闭而 sock 仍然打开 java.net.SocketTimeoutException:读取超时 - Getting error from Zookeeper Unexpected exception causing shutdown while sock still open java.net.SocketTimeoutException: Read timed out Java,收到奇怪的套接字异常:“管道损坏”和“操作超时” - Java, Getting a weird Socket Exception: “Broken pipe” and “Operation timed out” 获取 java.net.SocketTimeoutException:连接在 android 中超时 - Getting java.net.SocketTimeoutException: Connection timed out in android 获取 java.net.SocketTimeoutException:连接超时错误 - Getting java.net.SocketTimeoutException: connect timed out error 在Java中读取Socket超时异常的原因是什么? - What are the reasons for getting a Socket read timed out Exception in Java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM