title: Configuring postgresql driver through Spring xml datasource
body: <p>I've been trying to configure the connections made with a postgresql datasource declared in a xml Spring configuration file.</p>
  
  <pre><code>&lt;bean id="myDataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="org.postgresql.Driver" /&gt;
          &lt;property name="url" value="jdbc:postgresql://localhost:5432/dbname" /&gt;
          &lt;property name="username" value="postgres" /&gt;
          &lt;property name="password" value="" /&gt;
          &lt;property name="socketTimeout" value="10"/&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>I know, I shouldn't be using the <code>DriverManagerDataSource</code> class from spring, (we will soon move to C3p0 or DBCP) because it's not a real pooling.
  I'm trying to set the socketTimeout value of a postgresql connection ( described here <a href="https://jdbc.postgresql.org/documentation/head/connect.html" rel="noreferrer">https://jdbc.postgresql.org/documentation/head/connect.html</a> ) but of course, "socketTimeout" is not a property of the datasource, so it doesn't work.</p>
  
  <p>Is it possible to do this through the datasource xml's configuration ? Or should I do it somewhere else ? Because the data source manages the connection I don't think I'll be able to do a </p>
  
  <pre><code>props.setProperty("timeout",30);
  Connection conn = DriverManager.getConnection(url, props);
  </code></pre>
  
  <p>Can I even do this with the DriverManagerDataSource ? I tried to search, but I didn't find anything usefull, as not a lot of people are really using it.</p>