Open jgager opened 9 years ago
When I run the following in using JDBC, the DISTINCT selection is not applied:
String sparql = "sparql SELECT DISTINCT(?uri) {VALUES ?uri {<a><b><c><a>}}"; dataSource = new VirtuosoConnectionPoolDataSource(); dataSource.setServerName("server.ip.address"); dataSource.setPortNumber(1111); dataSource.setUser("dba"); dataSource.setPassword("dba"); dataSource.setCharset("UTF-8"); Statement s = null; ResultSet rs = null; Connection connection = null; try { connection = dataSource.getConnection(); s = connection.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = s.executeQuery(sparql); int count = 0; while (rs.next()) { count++; System.out.println(rs.getString(1)); } System.out .println("Found " + count + " records"); } catch (SQLException sqe) { System.err.println(sqe.getMessage()); } finally { if (rs != null) { try { rs.close(); rs = null; } catch (SQLException e) { // ignore } } if (s != null) { try { s.close(); s = null; } catch (SQLException e) { // ignore } } if (connection != null) { try { connection.close(); connection = null; } catch (SQLException e) { // ignore } } }
The result will be:
a b c a Found 4 records
Note that changing the result set type to forward only:
s = connection.createStatement( ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
works properly:
a b c Found 3 records
I have been able to recreate this issue and reported to development to look into ...
When I run the following in using JDBC, the DISTINCT selection is not applied:
The result will be:
Note that changing the result set type to forward only:
works properly: