title: Dynamic snowflake jdbc connection in java
body: <p>I was trying to create a dynamic JDBC connection in java to connect to snowflake.</p>
  
  <p>I am stuck at a point ,how can i pass the parameter from my property file into snowflake connection file</p>
  
  <p>Please find the attached code</p>
  
  <pre><code>package com.cisco.export.utils;
  
  
  import java.sql.*;
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  import java.util.Properties;
  
  import com.cisco.config.Configuration;
  
  
  
  public class SFDbConnection {
  
      public Connection getConnection(Configuration config) throws SQLException{
          Connection connection=null;
          try {
              System.out.println(config.getProp("sf.driverclass"));
              System.out.println(config.getProp("sf.url"));
              System.out.println(config.getProp("sf.account"));
              System.out.println(config.getProp("sf.username"));
              System.out.println(config.getProp("sf.password"));
              System.out.println(config.getProp("sf.warehouse"));
              System.out.println(config.getProp("sf.db"));
              System.out.println(config.getProp("sf.schema"));
              System.out.println(config.getProp("sf.role"));
  
  
  
  
              Class.forName(config.getProp("sf.driverclass"));
              String connectStr = "jdbc:snowflake://mysnowflakeaccount.us-east-1.snowflakecomputing.com";
                  connection = DriverManager.getConnection()
  
  
          } catch (ClassNotFoundException e) {
              e.printStackTrace();
          }
          return connection;
      }
  </code></pre>
  
  <p>Can some one Help me how  can  i make the parameters inside the getConnection() dynamic.</p>
  
  <p>Appreciate your help.</p>
  
  <p>Thanks,
  Nikhil</p>