title: Multiple users database connection pooling in JBoss AS/Wildfly
body: <p>I'm working on web application, that need access to postgresql database.</p>
  
  <p>For some reason, i need to establish individual connection, for every authenticated user.</p>
  
  <p>My current datasource setup looks like this:</p>
  
  <pre><code>&lt;datasource jndi-name="java:jboss/ds" pool-name="ds-pool" enabled="true"&gt;
                      &lt;connection-url&gt;jdbc:postgresql://192.168.1.2:5432/springdb&lt;/connection-url&gt;
                      &lt;driver&gt;postgresql-driver&lt;/driver&gt;
                      &lt;pool&gt;
                          &lt;min-pool-size&gt;5&lt;/min-pool-size&gt;
                          &lt;max-pool-size&gt;30&lt;/max-pool-size&gt;                       
                      &lt;/pool&gt;
                      &lt;security&gt;
                          &lt;user-name&gt;postgres&lt;/user-name&gt;
                          &lt;password&gt;postgres&lt;/password&gt;
                      &lt;/security&gt;
                  &lt;/datasource&gt;
  </code></pre>
  
  <p>In java code i do this:</p>
  
  <pre><code>@Resource(lookup = "java:jboss/ds")
  DataSource ds;
  conn = ds.getConnection(username, password);
  </code></pre>
  
  <p>And here is the problem. Every getConnection call produce following WARN in jboss console:</p>
  
  <pre><code>&gt; 14:07:48,665 WARN 
  &gt; [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (default
  &gt; task-11) IJ000612: Destroying connection that could not be
  &gt; successfully matched:
  &gt; org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@7de0e076[state=NORMAL
  &gt; managed
  &gt; connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@763ace0a
  &gt; connection handles=0 lastUse=1382422068665 trackByTx=false
  &gt; pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@36c78449
  &gt; mcp=SemaphoreArrayListManagedConnectionPool@64bdf0b7[pool=ds-pool]
  &gt; xaResource=LocalXAResourceImpl@ead2f2a[connectionListener=7de0e076
  &gt; connectionManager=26e60dae warned=false currentXid=null
  &gt; productName=PostgreSQL productVersion=9.3.3 jndiName=java:jboss/ds]
  &gt; txSync=null]
  </code></pre>
  
  <p>I've tried to add <strong>allow-multiple-users</strong> to <strong>pool</strong> configuration, but in jboss 7 i'm getting xml parse error, and in wildfly 8 it does nothing.</p>
  
  <p>So is there any way to get multiple users connection pool in jboss?</p>