Trying to connect Snowflake from AWS lambda using Java 8.
Class.forName("net.snowflake.client.jdbc.SnowflakeDriver"); // v3.9.1 as maven dependency
final Properties snowflakProperties = new Properties();
snowflakProperties.put("user", "username");
snowflakProperties.put("password", "password");
snowflakProperties.put("account", "account"); // accountname.regionname
snowflakProperties.put("db", "dbname");
snowflakProperties.put("schema", "schemaname");
snowflakProperties.put("role", "rolename");
DriverManager.getConnection("jdbc:snowflake://accountname.snowflakecomputing.com",
snowflakProperties);
Unfortunately, this is unable to connect and lambda goes out of time. Following trials has been taken place to solve :
Set environment variables in AWS lambda like SF_TEMPORARY_CREDENTIAL_CACHE_DIR and SF_OCSP_RESPONSE_CACHE_DIR to /tmp/. also tried JAVA_TOOL_OPTIONS as -Duser.home=/tmp/
JDBC version tried : 3.11.1, 3.9.1, 3.8.4
Tried to make cache directory as /home/ which throws an exception with message Failed to touch the cache file: /home/ocsp_response_cache.json
Still didn't get proper solution. Does AWS lambda doesn't allow to get Snowflake connection using temp directory ?
hence, look forward to solution quickly.
Thank you.