I get the following exception
[Microsoft] [SQLServer 2000 driver for JDBC] Connection reset by peer: socket write error
This happens on the application server when a web application tries to access a database located on another machine over the network. Now I read a few posts about this and found many different answers. One of them is updating the jtds driver from the driver com.microsoft.jdbc.sqlserver.SQLServerDriverthat we are currently using. Some say to change the size of the pool, some say that the network firewall closes the connection. However, everyone in these messages says that they solved the problem by restarting the application server. However, my problem is different in that the error will appear after a while, cause a bunch of errors, and then leave, and the system will work fine.
I talked with the system administrator and he told me that there were no network outages and insisted that this was not a network.
So my question is, for those of you who have solved this problem, which solution is better? Update driver, change connection pool settings, switch to C3P0 in sleep mode?
Below is spring xml for configuring a sleep mode data source
<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 XML spring for the Hibernate factory session for this data source
<bean id="theSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" ref="dataSource" />
<property name="useTransactionAwareDataSource" value="true" />
<property name="mappingResources">
<list>
</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 more note: this data source is only ready if it helps to make this problem a little easier to fix.
Thanks!
source
share