Программа Snowflake JDB C не работает - PullRequest
0 голосов
/ 07 марта 2020
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 выдает «Неверное имя пользователя или пароль»

1 Ответ

0 голосов
/ 08 марта 2020

Измените property.put с учетной записью на это, и у вас все будет в порядке:

properties.put("account", "ina88167"); // replace "" with your account name
...