I'm using a c3p0 Connection Pool to connect to an SQL Server 2008 database. As you can see below, minPoolSize is set to 10 but only one jTDS process is started in SQL Server.
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close" >
<property name="acquireIncrement" value="20" />
<property name="idleConnectionTestPeriod" value="60"/>
<property name="maxConnectionAge" value="7200" />
<property name="preferredTestQuery" value="select 1" />
<property name="maxIdleTime" value="1200" />
<property name="maxPoolSize" value="250" />
<property name="maxStatements" value="50" />
<property name="minPoolSize" value="10" />
<property name="driverClass" value="${database.driver}" />
<property name="jdbcUrl" value="${database.url}" />
<property name="password" value="${database.password}" />
<property name="user" value="${database.user}" />
</bean>
"Maximum number of concurrent connections (0 = unlimited):" in SQL Server is set to 0.
Any ideas what the problem could be?
The problem was that I was connecting to my database on port 1434. That port was a Dedicated Admin Connection and SQL Server only allowed one connection on that port.
Error message in SQL Server log:
Could not connect because the maximum number of '1' dedicated administrator connections already exists. Before a new connection can be made, the existing dedicated administrator connection must be dropped, either by logging off or ending the process. [CLIENT: 127.0.0.1]
Error: 17810, Severity: 20, State: 2.
I solved the problem by enabling TCP/IP and changeing port to 1433.
Enable TCP/IP:
Open SQL Server Configuration Manager->SQL Server Network Configuration->Protocols for MSSQLSERVER double click TCP/IP and select Enabled Yes.