diff --git a/src/main/java/net/ttddyy/dsproxy/proxy/CachedRowSetResultSetProxyLogicFactory.java b/src/main/java/net/ttddyy/dsproxy/proxy/CachedRowSetResultSetProxyLogicFactory.java index 1fed5a06..367f2d8a 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 ex) { + throw new RuntimeException(ex); + } + } + @Override public ResultSetProxyLogic create(ResultSet resultSet, ConnectionInfo connectionInfo, ProxyConfig proxyConfig) { ResultSet cachedRowSet = getCachedRowSet(resultSet); @@ -40,8 +50,7 @@ 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 cachedRowSet = this.rowSetFactory.createCachedRowSet(); cachedRowSet.populate(resultSet); return cachedRowSet; } else {