To configure the driver to use user ID/Password authentication.
  • Set the AuthenticationMethod property to userIdPassword. Since userIdPassword is the default, it does not have to be specified in a connection URL used for user ID/password implementations.
  • Set the AccountName property to specify the full name of your account and the region where it is hosted. For example, account_name.us-east-1.
  • Set the DatabaseName property to specify the name of the database to which you are connecting.
  • Set the Schema property to specify the default schema to use for the specified database once connected. The specified schema should be an existing schema for which the specified default role has privileges.
  • Set the Warehouse property to specify the virtual warehouse to use once connected. The specified warehouse should be an existing warehouse for which the specified default role has privileges.
  • Set the User property to provide the user ID.
  • Set the Password property to provide the password.

The following examples demonstrate how to make a connection using the user ID/password authentication.

Connection URL:

Connection conn = DriverManager.getConnection 
("jdbc:datadirect:snowflake:AccountName=account_name.us-east-1;
  DatabaseName=payroll;Schema=xyz;Warehouse=accounting;
  User=jsmith;Password=secret);
Note: The User ID and Password properties are not required to be stored in the connection string. They can also be passed separately by the application.

Data Source:

SnowflakeDataSource mds = new SnowflakeDataSource();
mds.setDescription("My Snowflake Data Source");
mds.setAccountName("account_name.us-east-1");
mds.setDatabaseName("payroll");
mds.setSchema("xyz");
mds.setWarehouse("accounting");
mds.setUser("jsmith");
mds.setPassword("secret");