Snowflake JDBC程序失败

问题描述 投票:0回答:1
private static Connection getConnection()
throws SQLException {
   try {
       Class.forName("net.snowflake.client.jdbc.SnowflakeDriver");
   } catch (ClassNotFoundException ex) {
       System.err.println("Driver not found");
   }
   // build connection properties
   Properties properties = new Properties();
   properties.put("user", "#####"); // replace "" with your username
   properties.put("password", "#####"); // replace "" with your password
   properties.put("account", "ina88167.us-east-1"); // replace "" with your account name
   properties.put("db", "DEMO_DB"); // replace "" with target database name
   properties.put("warehouse", "MY_WAREHOUSE"); // replace "" with target warehouse name
   properties.put("schema", "PUBLIC"); // replace "" with target schema name
   //properties.put("tracing", "on");

   // create a new connection
   String connectStr = System.getenv("SF_JDBC_CONNECT_STRING");
   // use the default connection string if it is not set in environment
   if (connectStr == null) {
       connectStr = "jdbc:snowflake://ina88167.us-east-1.snowflakecomputing.com/"; // replace accountName with your account name
   }
   return DriverManager.getConnection(connectStr, properties);
}

getconnection提供“无效的用户名或密码”]

database jdbc snowflake-data-warehouse
1个回答
0
投票

将帐户的property.put更改为此,您应该可以:

properties.put("account", "ina88167"); // replace "" with your account name
© www.soinside.com 2019 - 2024. All rights reserved.