title: The "Only one usage of each socket address" error in ZF3 on Windows Server 2008
body: <p>I'm migrating the DBAL of a Zend Framework 3 application to Doctrine. The migration of the data retrieving part is completed. The data saving is yet remaining to be <code>Zend\Db</code> driven.</p>
  
  <p>Now I want to deploy the new version to the server and get this error:</p>
  
  <blockquote>
    <p>[PDOException: SQLSTATE[HY000] [2002] Only one usage of each socket
    address (protocol/network address/port) is normally permitted. in
    D:\Path\to\my-project\vendor\zendframework\zend-db\src\Adapter\Driver\Pdo\Connection.php:266</p>
  </blockquote>
  
  <p>The error doesn't occur on my local Debian virtual machine, but only when running PHPUnit on the Windows Server.</p>
  
  <p>Just took a look into the <a href="https://github.com/zendframework/zend-db/blob/d2c0e4f00fd46639cd1d6f3c4c55ec32646496ae/src/Adapter/Driver/Pdo/Connection.php#L266" rel="nofollow noreferrer">Zend\Db\Adapter\Driver\Pdo\Connection.php:266</a>. It's the place, where <code>Zend\Db</code> tries to create a new connection.</p>
  
  <p>Since this problem hasn't been observed before, I suppose, that it's related to the (partial) migration to Doctrine. Maybe the application doesn't close a database connection opened for <code>Zend\Db</code> and tries to open a new one with exactly the same settings for Doctrine. Or vice versa: A PDO connection for Doctrine is opened and in the same time the framework tries to open a new one for <code>Zend\Db</code>.</p>
  
  <p>How to resolve this issue and work with both Doctrine and <code>Zend\Db</code>?</p>