title: Use custom creds while using DropWizard JDBI
body: <p>I'm developing a webservice using Dropwizard JDBI framework. </p>
  
  <p>Now, instead of having a db configurations in yaml file, I want to use 'user specified params' what i mean to say is, the db configs will be provided through the endpoint url. </p>
  
  <ul>
  <li>Is having custom creds possible through dropwizard jdbi? </li>
  </ul>
  
  <p>if yes, what changes should i be thinking to do in the code while referring this ?  -> </p>
  
  <p><a href="http://dropwizard.readthedocs.org/en/latest/manual/jdbi.html" rel="nofollow">http://dropwizard.readthedocs.org/en/latest/manual/jdbi.html</a> </p>
  
  <p>I understand, in normal flow, the service method gets the config details in the run method - </p>
  
  <p>-- Config Class</p>
  
  <pre><code>public class ExampleConfiguration extends Configuration {
      @Valid
      @NotNull
      @JsonProperty
      private DatabaseConfiguration database = new DatabaseConfiguration();
  
      public DatabaseConfiguration getDatabaseConfiguration() {
          return database;
      }
  }
  </code></pre>
  
  <p>-- Service Class</p>
  
  <pre><code>@Override
          public void run(ExampleConfiguration config,
                          Environment environment) throws ClassNotFoundException {
              final DBIFactory factory = new DBIFactory();
              final DBI jdbi = factory.build(environment, config.getDatabaseConfiguration(), "postgresql");
              final UserDAO dao = jdbi.onDemand(UserDAO.class);
              environment.addResource(new UserResource(dao));
          }
  </code></pre>
  
  <p>-- and yaml </p>
  
  <pre><code>database:
    # the name of your JDBC driver
    driverClass: org.postgresql.Driver
  
    # the username
    user: pg-user
  
    # the password
    password: iAMs00perSecrEET
  
    # the JDBC URL
    url: jdbc:postgresql://db.example.com/db-prod
  </code></pre>
  
  <hr>
  
  <p>But in this case, I might get the config details in the Resource level... </p>
  
  <p>smthing like - </p>
  
  <pre><code>@GET
  @Path(value = "/getProduct/{Id}/{dbUrl}/{dbUname}/{dbPass}")
  @Produces(MediaType.APPLICATION_JSON)
  public Product getProductById(@PathParam(value = "Id") int Id,
          @PathParam(value = "dbUrl") String dbUrl,
          @PathParam(value = "dbUname") String dbUname,
          @PathParam(value = "dbPath") String dbPass) {
  
       //I have to connect to the DB here! using the params i have.         
       return new Product(); //should return the Product
  }
  </code></pre>
  
  <p>I'd appreciate if someone can point me a direction. </p>