使用RowSetProvider获取RowSetFactory的原因是什么?

时间:2014-08-31 12:50:49

标签: java jdbc rowset

我注意到如果使用

,我会得到相同的结果
    RowSetFactory rowSetFactory = RowSetProvider.newFactory();

    rowSetFactory = new RowSetFactoryImpl();

newFactory方法实现:

public static RowSetFactory newFactory()
            throws SQLException {
        // Use the system property first
        RowSetFactory factory = null;
        String factoryClassName = null;
        try {
            trace("Checking for Rowset System Property...");
            factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
            if (factoryClassName != null) {
                trace("Found system property, value=" + factoryClassName);
                factory = (RowSetFactory) getFactoryClass(factoryClassName, null, true).newInstance();
            }
        } catch (ClassNotFoundException e) {
            throw new SQLException(
                    "RowSetFactory: " + factoryClassName + " not found", e);
        } catch (Exception e) {
            throw new SQLException(
                    "RowSetFactory: " + factoryClassName + " could not be instantiated: " + e,
                    e);
        }

在这里,我们看到此方法返回在system.property中设置的RowSetFactory

更改此系统属性的原因是什么?

默认情况下,谁设置此属性?

0 个答案:

没有答案