开发者

Connection Reset by Peer Error

开发者 https://www.devze.com 2022-12-08 09:21 出处:网络
I am getting the following exception [Microsoft][SQLServer 2000 Driver for JDBC]Connection reset by peer: socket write error

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 d开发者_JAVA百科atasource

<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!


Make sure you have the basics right such as hostname and port. Also, please check that the firewalls on both ends are not interfering i.e. allow traffic to pass through the required ports.

TCP reset means that something is on the other side, but the connection was forcibly closed from the other end, see here, which to me seems typical of a firewall or IPS system. If all these basic check were done, then the best way to proceed would be to upgrade your software in case of obscure bugs and try again.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号