title: How to access connection url
body: <p>I am using spring jdbc. I am using the following code to get jdbc connection</p>
  
  <pre><code>public void setDataSource(DataSource dataSource){
          this.dataSource = dataSource;
          setJdbcTemplate(new JdbcTemplate(this.dataSource));
          setNamedParamdbcTemplate(new NamedParameterJdbcTemplate(this.dataSource));
          if(connectionUrl==null){
          Connection con;
  
              try {
                  con = getJdbcTemplate().getDataSource().getConnection();
                  connectionUrl = con.getMetaData().getURL();
              } catch (SQLException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
          }
      }
  </code></pre>
  
  <p>But I am getting the following exception.</p>
  
  <blockquote>
    <p>No managed connections available within configured blocking timeout
    (0 [ms])</p>
  </blockquote>
  
  <p>I Have took the print by debugging the code. the above is the output for <code>getJdbcTemplate().getDataSource()</code> code.</p>
  
  <p><a href="https://i.stack.imgur.com/2Veaf.png" rel="nofollow noreferrer">Click here for the image</a>
  If I wrote <code>getJdbcTemplate().getDataSource().getConnection();</code>the following exception is coming. How can I access the 
  connectionURL That is present in the image.</p>
  
  <blockquote>
    <p>No managed connections available within configured blocking timeout (0
    [ms])</p>
  </blockquote>