Hi,
I am getting the following exception
[Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error
Its happening on the application server when the web app tries to access a database located on another machine over a network. Now I have read some posts on this, and found many different answers. One was upgrading to the jtds driver from the com.microsoft.jdbc.sqlserver.SQLServerDriver driver that we are using currently. Some say to change the pool size, some say its the network's firewall closing the connections. However, everyone in these posts says they solved the problem by restarting the application server. However my problem differs as the error will pop up once in awhile, cause a bunch of errors, then go away and the system will work fine.
I talked to the system admin, and he told me that there are no network outages and insists it is not the network.
So my question is, for those of you who have solved this issue, which solution is best? Do I upgrade the driver, change the connection pool settings, upgrade to C3P0 in hibernate?
Below is the spring xml for configuring the hibernate datasource
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />
<property name="url" value="jdbc:microsoft:sqlserver://databasecomp.company.com:1433;databaseName=DBNAME;" />
<property name="username" value="username" />
<property name="password" value="password" />
</bean>
And here is the Spring XML for the Hibernate session factory for this datasource
<bean id="theSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" ref="dataSource" />
<property name="useTransactionAwareDataSource" value="true" />
<property name="mappingResources">
<list>
<!-- Omitted for clarity -->
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="connection.pool_size">1</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
</props>
</property>
One other note: This datasource is ready only, if that helps make this problem a bit easier to fix.
Thanks!