Java Code Examples for javax.sql.rowset.RowSetProvider

The following examples show how to use javax.sql.rowset.RowSetProvider. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 2
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 3
Source Project: jdk8u60   Source File: RowSetFactoryTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 4
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 5
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 6
Source Project: jdk8u-jdk   Source File: RowSetFactoryTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 7
Source Project: hottub   Source File: RowSetFactoryTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 8
Source Project: jdk8u_jdk   Source File: RowSetFactoryTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@DataProvider(name = "RowSetValues")
private Object[][] RowSetValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, DEFAULT_CACHEDROWSET_CLASSNAME},
        {rsf, DEFAULT_FILTEREDROWSET_CLASSNAME},
        {rsf, DEFAULT_JDBCROWSET_CLASSNAME},
        {rsf, DEFAULT_JOINROWSET_CLASSNAME},
        {rsf, DEFAULT_WEBROWSET_CLASSNAME},
        {rsf1, STUB_CACHEDROWSET_CLASSNAME},
        {rsf1, STUB_FILTEREDROWSET_CLASSNAME},
        {rsf1, STUB_JDBCROWSET_CLASSNAME},
        {rsf1, STUB_JOINROWSET_CLASSNAME},
        {rsf1, STUB_WEBROWSET_CLASSNAME}

    };
}
 
Example 9
public CommonRowSetTests() {
    try {
        rsf = RowSetProvider.newFactory();
    } catch (SQLException ex) {
        Assert.fail(ex.getMessage());
    }
}
 
Example 10
@Test
public void test04() throws Exception {
    File f = new File(jarPath + "goodFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    validateProvider(RowSetProvider.newFactory(), STUB_FACTORY_CLASSNAME);
}
 
Example 11
@Test(expectedExceptions = SQLException.class)
public void test05() throws Exception {
    File f = new File(jarPath + "badFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    RowSetProvider.newFactory();
}
 
Example 12
@DataProvider(name = "RowSetFactoryValues")
private Object[][] RowSetFactoryValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    RowSetFactory rsf2 = RowSetProvider.newFactory(DEFFAULT_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, NO_VALADATE_IMPL},
        {rsf, DEFFAULT_FACTORY_CLASSNAME},
        {rsf1, STUB_FACTORY_CLASSNAME},
        {rsf2, DEFFAULT_FACTORY_CLASSNAME}
    };
}
 
Example 13
public CommonRowSetTests() {
    try {
        rsf = RowSetProvider.newFactory();
    } catch (SQLException ex) {
        Assert.fail(ex.getMessage());
    }
}
 
Example 14
@Test
public void test04() throws Exception {
    File f = new File(jarPath + "goodFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    validateProvider(RowSetProvider.newFactory(), STUB_FACTORY_CLASSNAME);
}
 
Example 15
@Test(expectedExceptions = SQLException.class)
public void test05() throws Exception {
    File f = new File(jarPath + "badFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    RowSetProvider.newFactory();
}
 
Example 16
@DataProvider(name = "RowSetFactoryValues")
private Object[][] RowSetFactoryValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    RowSetFactory rsf2 = RowSetProvider.newFactory(DEFFAULT_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, NO_VALADATE_IMPL},
        {rsf, DEFFAULT_FACTORY_CLASSNAME},
        {rsf1, STUB_FACTORY_CLASSNAME},
        {rsf2, DEFFAULT_FACTORY_CLASSNAME}
    };
}
 
Example 17
Source Project: jdk8u60   Source File: CommonRowSetTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
public CommonRowSetTests() {
    try {
        rsf = RowSetProvider.newFactory();
    } catch (SQLException ex) {
        Assert.fail(ex.getMessage());
    }
}
 
Example 18
Source Project: jdk8u60   Source File: RowSetProviderTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test04() throws Exception {
    File f = new File(jarPath + "goodFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    validateProvider(RowSetProvider.newFactory(), STUB_FACTORY_CLASSNAME);
}
 
Example 19
Source Project: jdk8u60   Source File: RowSetProviderTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test(expectedExceptions = SQLException.class)
public void test05() throws Exception {
    File f = new File(jarPath + "badFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    RowSetProvider.newFactory();
}
 
Example 20
Source Project: jdk8u60   Source File: RowSetProviderTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@DataProvider(name = "RowSetFactoryValues")
private Object[][] RowSetFactoryValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    RowSetFactory rsf2 = RowSetProvider.newFactory(DEFFAULT_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, NO_VALADATE_IMPL},
        {rsf, DEFFAULT_FACTORY_CLASSNAME},
        {rsf1, STUB_FACTORY_CLASSNAME},
        {rsf2, DEFFAULT_FACTORY_CLASSNAME}
    };
}
 
Example 21
Source Project: datawave   Source File: CachedResultsCleanupBean.java    License: Apache License 2.0 5 votes vote down vote up
@PostConstruct
public void init() {
    try {
        rowSetProvider = RowSetProvider.newFactory();
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }
}
 
Example 22
Source Project: datawave   Source File: CachedRunningQuery.java    License: Apache License 2.0 5 votes vote down vote up
private void initialize() throws SQLException {
    
    this.sqlQuery = this.generateSql(this.view, this.fields, this.conditions, this.grouping, this.order, this.user, this.connection);
    this.getMetric().setQuery(sqlQuery);
    
    this.crs = RowSetProvider.newFactory().createCachedRowSet();
    this.crs.setCommand(this.sqlQuery);
    
    String countQuery = "SELECT count(*) FROM (" + this.sqlQuery + ") AS CNT";
    log.trace("Count query: " + countQuery);
    try (Statement s = connection.createStatement(); ResultSet rs = s.executeQuery(countQuery)) {
        if (rs.next())
            this.totalRows = rs.getInt(1);
        else
            throw new SQLException("Count query did not return a result");
    }
    
    if (this.pagesize < this.totalRows) {
        this.crs.setPageSize(this.pagesize);
    } else {
        this.crs.setPageSize(this.totalRows);
    }
    
    if (log.isTraceEnabled()) {
        log.trace("Setting pageSize to " + crs.getPageSize());
        log.trace("Setting maxRows to " + crs.getMaxRows());
        log.trace("Setting totalRows to " + this.totalRows);
    }
    
    this.crs.execute(this.connection);
    this.crs.beforeFirst();
    this.currentRow = position.BEFORE_FIRST;
}
 
Example 23
Source Project: datawave   Source File: CachedRunningQuery.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Return a specific page of results.
 * 
 * @return next page of results
 * @throws SQLException
 */
public ResultsPage getRows(Integer rowBegin, Integer rowEnd, long pageByteTrigger) throws SQLException {
    if (log.isTraceEnabled())
        log.trace("getRows: begin=" + rowBegin + ", end=" + rowEnd);
    // update timestamp in case this operation takes a long time.
    updateTimestamp();
    long pageStartTime = System.currentTimeMillis();
    
    // We need to apply a default ORDER BY clause if one does not EXIST in the query
    StringBuilder query = new StringBuilder(this.sqlQuery);
    if (!this.sqlQuery.toUpperCase().contains(" ORDER BY ")) {
        query.append(DEFAULT_ORDER_BY);
    }
    
    ResultsPage resultList;
    int pagesize = (rowEnd - rowBegin) + 1;
    
    try (PreparedStatement ps = connection.prepareStatement(query.toString()); CachedRowSet crs = RowSetProvider.newFactory().createCachedRowSet()) {
        log.debug("Get Rows query: " + query);
        
        ps.setFetchSize(pagesize);
        crs.setPageSize(pagesize);
        
        try (ResultSet rs = ps.executeQuery()) {
            crs.populate(rs, rowBegin);
            resultList = convert(crs, rowBegin, rowEnd, pageByteTrigger);
        }
        
        // Update the metric
        long now = System.currentTimeMillis();
        this.getMetric().addPageTime(resultList.getResults().size(), (now - pageStartTime), pageStartTime, now);
        updateTimestamp();
        return resultList;
    }
}
 
Example 24
Source Project: cactoos-jdbc   Source File: StatementSelect.java    License: MIT License 5 votes vote down vote up
@Override
public ResultSet result() throws Exception {
    // @checkstyle NestedTryDepthCheck (10 lines)
    try (Connection conn = this.session.connection()) {
        try (PreparedStatement stmt = this.query.prepared(conn)) {
            try (ResultSet rset = stmt.executeQuery()) {
                final RowSetFactory rsf = RowSetProvider.newFactory();
                final CachedRowSet crs = rsf.createCachedRowSet();
                crs.populate(rset);
                return crs;
            }
        }
    }
}
 
Example 25
public CommonRowSetTests() {
    try {
        rsf = RowSetProvider.newFactory();
    } catch (SQLException ex) {
        Assert.fail(ex.getMessage());
    }
}
 
Example 26
@Test
public void test04() throws Exception {
    File f = new File(jarPath + "goodFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    validateProvider(RowSetProvider.newFactory(), STUB_FACTORY_CLASSNAME);
}
 
Example 27
@Test(expectedExceptions = SQLException.class)
public void test05() throws Exception {
    File f = new File(jarPath + "badFactory");
    URLClassLoader loader = new URLClassLoader(new URL[]{
        new URL(f.toURI().toString())}, getClass().getClassLoader());
    Thread.currentThread().setContextClassLoader(loader);
    RowSetProvider.newFactory();
}
 
Example 28
@DataProvider(name = "RowSetFactoryValues")
private Object[][] RowSetFactoryValues() throws SQLException {
    RowSetFactory rsf = RowSetProvider.newFactory();
    RowSetFactory rsf1 = RowSetProvider.newFactory(STUB_FACTORY_CLASSNAME, null);
    RowSetFactory rsf2 = RowSetProvider.newFactory(DEFFAULT_FACTORY_CLASSNAME, null);
    return new Object[][]{
        {rsf, NO_VALADATE_IMPL},
        {rsf, DEFFAULT_FACTORY_CLASSNAME},
        {rsf1, STUB_FACTORY_CLASSNAME},
        {rsf2, DEFFAULT_FACTORY_CLASSNAME}
    };
}
 
Example 29
public StandardCachedRowSetFactory() {
	try {
		this.rowSetFactory = RowSetProvider.newFactory();
	}
	catch (SQLException ex) {
		throw new IllegalStateException("Cannot create RowSetFactory through RowSetProvider", ex);
	}
}
 
Example 30
Source Project: effectivejava   Source File: SqlRowSetResultSetExtractor.java    License: Apache License 2.0 5 votes vote down vote up
public StandardCachedRowSetFactory() {
	try {
		this.rowSetFactory = RowSetProvider.newFactory();
	}
	catch (SQLException ex) {
		throw new IllegalStateException("Cannot create RowSetFactory through RowSetProvider", ex);
	}
}