activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jamie McCrindle" <jamiemccrin...@gmail.com>
Subject Re: sqlserver/ jtds "Address already in use: connect" exceptions under load
Date Fri, 14 Jul 2006 13:10:03 GMT
Given up on jTDS now and moved to the Microsoft JDBC drivers which are
behaving better. Certainly in terms of client connections.

The info up on the wiki is for the SqlServer 2000 drivers. Here's info
for the SqlServer 2005 drivers:

You can download it from here: http://msdn.microsoft.com/data/ref/jdbc/

and the activemq config should look like this:

    <persistenceAdapter>
	    <journaledJDBC journalLogFiles="5"
dataDirectory="../activemq-data" dataSource="#mssql-ds">
			<adapter><imageBasedJDBCAdaptor/></adapter>
	    </journaledJDBC>
    </persistenceAdapter>

	<bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
		<property name="url"
value="jdbc:sqlserver://HOST:PORT;databaseName=DBNAME;user=USER;password=PASSWORD"/>
		<property name="username" value="USER"/>
		<property name="password" value="PASSWORD"/>
	</bean>

I'll update the wiki to include this info.

cheers,
j.

On 7/13/06, Jamie McCrindle <jamiemccrindle@gmail.com> wrote:
> Some more info:
>
> It's definitely an issue with the jtds driver creating too many
> connections which end up in TIME_WAIT and then running out of client
> connections (verified using tcpview). I was using the dbcp
> BasicDataSource as in:
>
>   <bean id="mssql-ds" class="org.apache.commons.dbcp.BasicDataSource"
> destroy-method="close">
>     <property name="driverClassName"
> value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
>     <property name="url"
> value="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=DB"/>
>     <property name="username" value="username"/>
>     <property name="password" value="password"/>
>     <property name="poolPreparedStatements" value="true"/>
>   </bean>
>
> which resulted in the "Address already in use: connect" issue. By
> moving to the following configuration:
>
>   <bean id="mssql-ds" class="net.sourceforge.jtds.jdbcx.JtdsDataSource">
>     <property name="serverName" value="localhost"/>
>     <property name="portNumber" value="1443"/>
>     <property name="databaseName" value="xxx"/>
>     <property name="user" value="xxx"/>
>     <property name="password" value="xxx"/>
>   </bean>
>
> the exception goes away but the too many connections problem is still
> there. the jtdsdatasource just pauses until the TIME_WAIT connections
> free up and then carries on from where it left off.
>
> It's all a bit odd because this message from the jtds guys suggests
> that it shouldn't be using quite so many connections:
>
> http://forum.java.sun.com/thread.jspa?messageID=3973963
>
> i could mess with my operating system's tcp settings to reduce the
> TcpTimedWaitDelay but it feels more like treating the symptoms rather
> than addressing the problem.
>
> I'll see if I can get more information from the jtds guys but if
> anyone else has solved the problem for activemq and mssqlserver or has
> any ideas, let me know.
>
> cheers,
> j.
>
> On 7/12/06, Jamie McCrindle <jamiemccrindle@gmail.com> wrote:
> > Hi all,
> >
> > First off, thanks for fixing the autocommit bug in 4.0.1. I've
> > upgraded now and I seem to be getting a new problem using sqlserver
> > 2005 and jtds under load, specifically:
> >
> > Caused by: java.net.BindException: Address already in use: connect
> >         at java.net.PlainSocketImpl.socketConnect(Native Method)
> >         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> >         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
> >         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> >         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> >         at java.net.Socket.connect(Socket.java:507)
> >         at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
> >         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > sorImpl.java:25)
> >         at java.lang.reflect.Method.invoke(Method.java:585)
> >         at net.sourceforge.jtds.jdbc.SharedSocket.createSocketForJDBC3(SharedSoc
> > ket.java:289)
> >         at net.sourceforge.jtds.jdbc.SharedSocket.<init>(SharedSocket.java:250)
> >         at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java
> > :297)
> >
> > The only reference on the internets that I could find related to this issue is:
> >
> > http://sourceforge.net/forum/message.php?msg_id=2377819
> >
> > any idea's?
> >
> > versions of things:
> >
> > SQLServer 2005
> > jTDS 1.2
> >
> > cheers,
> > j.
> >
>

Mime
View raw message