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提供“无效的用户名或密码”]
将帐户的property.put更改为此,您应该可以:
properties.put("account", "ina88167"); // replace "" with your account name