diff --git a/src/main/java/net/ttddyy/dsproxy/proxy/CachedRowSetResultSetProxyLogicFactory.java b/src/main/java/net/ttddyy/dsproxy/proxy/CachedRowSetResultSetProxyLogicFactory.java index 1fed5a06..1ad8a06b 100644 --- a/src/main/java/net/ttddyy/dsproxy/proxy/CachedRowSetResultSetProxyLogicFactory.java +++ b/src/main/java/net/ttddyy/dsproxy/proxy/CachedRowSetResultSetProxyLogicFactory.java @@ -30,6 +30,16 @@ @IgnoreJRERequirement public class CachedRowSetResultSetProxyLogicFactory implements ResultSetProxyLogicFactory { + private final RowSetFactory rowSetFactory; + + public CachedRowSetResultSetProxyLogicFactory() { + try { + this.rowSetFactory = RowSetProvider.newFactory(); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + @Override public ResultSetProxyLogic create(ResultSet resultSet, ConnectionInfo connectionInfo, ProxyConfig proxyConfig) { ResultSet cachedRowSet = getCachedRowSet(resultSet); @@ -40,7 +50,6 @@ protected ResultSet getCachedRowSet(ResultSet resultSet) { try { // CachedRowSet only works with non-null ResultSet if (resultSet.getMetaData().getColumnCount() > 0) { - RowSetFactory rowSetFactory = RowSetProvider.newFactory(); CachedRowSet cachedRowSet = rowSetFactory.createCachedRowSet(); cachedRowSet.populate(resultSet); return cachedRowSet;