title: Google dataflow JDBCIO passing SSL certificate using Java?
body: <p>I am trying to pass the SSL certificate to the connection properties in JDBCIO. read() and I keep getting the error
  &quot;No such file or directory exists - /tmp/.jks&quot;</p>
  <p>What I have tried - I have a class that reads the .jks file from my GCS bucket and then writes it to local file system - /tmp/.jks file.</p>
  <p>I am then passing /tmp/.jks file path as SSLTrustStorePath=/tmp/.jks;SSLTrustPassword=1234AB</p>
  <p>Can someone please help me resolve this issue.</p>
  <pre><code> pipeline.apply(&quot;Read from JDBC presto&quot;, JdbcIO.&lt;TableRow&gt;read().withDataSourceConfiguration(
                      JdbcIO.DataSourceConfiguration.create(JDBC_DRIVER, jdbcUrl)
                              .withUsername(&quot;username&quot;)
                              .withPassword(&quot;pswd&quot;).withConnectionProperties(new ConsumerFactoryFn().apply(&quot;&quot;)))
                      .withQuery(&quot;select * from tablename&quot;)
                      .withCoder(TableRowJsonCoder.of())
                      .withRowMapper(new JdbcIO.RowMapper&lt;TableRow&gt;() {
                          public TableRow mapRow(ResultSet resultSet) throws Exception {
  
                              ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
                              TableRow outputTableRow = new TableRow();
                              for (int i = 1; i &lt;= resultSetMetaData.getColumnCount(); i++) {
                                  outputTableRow.set(resultSetMetaData.getColumnName(i), resultSet.getObject(i));
                          }
                          return outputTableRow;
                      }
                  })).apply(&quot;Write to BigQuery&quot;,
                          BigQueryIO.writeTableRows()
                                  .withoutValidation()
                                  .withCreateDisposition(BigQueryIO.Write.CreateDisposition.CREATE_NEVER)
                                  .withWriteDisposition(BigQueryIO.Write.WriteDisposition.WRITE_APPEND)
                                  .to(&quot;projectID:dataset.tablename&quot;));
  </code></pre>
  <p>This is in the ConsumerFactoryFn</p>
  <pre><code>public String apply(String input) {
          try {
              Storage storage = StorageOptions.getDefaultInstance().getService();
              Blob blob = storage.get(&quot;bucketname&quot;, &quot;certificate.jks&quot;);
              ReadChannel readChannel = blob.reader();
              FileOutputStream fileOuputStream;
              fileOuputStream = new FileOutputStream(&quot;/tmp/filename.jks&quot;); // path where the jks file will be
                                                                                      // stored
              fileOuputStream.getChannel().transferFrom(readChannel, 0, Long.MAX_VALUE);
              fileOuputStream.close();
              File f = new File(&quot;/tmp/filename.jks&quot;); // assuring the store file exists
              if (f.exists()) {
                  logger.info(&quot;key exists&quot;);
  
              } else {
                  logger.warn(&quot;key does not exist&quot;);
  
              }
             File file = Files.createTempDir().createTempFile(&quot;filename&quot;,&quot;.jks&quot;, f);
              logger.info(&quot;file name is&quot;+file.getAbsolutePath());
  
          } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              logger.error(e.getMessage());
          } catch (IOException e) {
              // TODO Auto-generated catch block
              logger.error(e.getMessage());
          }
  
          input = &quot;SSLTrustStorePath=/tmp/filename.jks;SSLTrustStorePassword=pswd&quot;;
  
          return input;
      }
  </code></pre>