powered by Jive Software

JDBC providers not using connection pooling

It seems that JDBCAuthProvider, JDBCUserProvider and JDBCGroupProvider are not using connection pooling. In my system, this is causing errors such as:

[org.jivesoftware.openfire.group.JDBCGroupProvider.getGroup(JDBCGroupProvider.ja va:141)

]

java.sql.SQLException: Network error IOException: Address already in use: connect

at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:372)

It seems to be thrown exclusively from JDBCGroupProvider, specifically in the getGroup and getMembers methods. This is likely due to my environment having 922 groups and 10,000 users. It does appear that the data is caches, however. So that may help somewhat.

I’‘m looking for ideas on avoiding these errors. Would it make sense for me to try to refactor JDBCGroupProvider to use DbConnectionManager to get a connection (which can be pooled)? Right now, it’'s getting a connection directly whenever it needs one.

Nevermind… looks like this may have been related to some code modifications I was making. I rolled it back and the errors have not re-occured yet.

I spoke too soon. I have started using tsung to do some load testing, and I’‘m running into this issue again. This time, it’‘s in the JDBCAuthProvider. I have not written any code for that component; I’'m simply putting my datasource and the SQL statements into the openfire.xml.

The error I’'m getting is the same:

2007.07.26 11:30:21 [org.jivesoftware.openfire.auth.JDBCAuthProvider.getPasswordValue(JDBCAuthProvi der.java:208)

] Exception in JDBCAuthProvider

java.sql.SQLException: Network error IOException: Address already in use: connect

at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC3.java:50)

at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:178)

at java.sql.DriverManager.getConnection(Unknown Source)

at java.sql.DriverManager.getConnection(Unknown Source)

at org.jivesoftware.openfire.auth.JDBCAuthProvider.getPasswordValue(JDBCAuthProvid er.java:194)

at org.jivesoftware.openfire.auth.JDBCAuthProvider.authenticate(JDBCAuthProvider.j ava:104)

at org.jivesoftware.openfire.auth.AuthFactory.authenticate(AuthFactory.java:149)

Caused by: java.net.BindException: Address already in use: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(Unknown Source)

By way of more information, here are the pertinent bits of my openfire.xml:

I notice that the recommended JDBC driver is FreeTDS, where-as I am using jtds because I’'m on Windows and FreeTDS is Linux only. Does FreeTDS support connection pooling? Perhaps that is why there is no connection pooling in the actual JDBCAuthProvider code.