DB2 JDBC: "Same" query yields different results

I was commissioned to develop a small Java application to process some data from a DB2 database (used to record business transactions), and I know a little about the internal database settings. I'm currently struggling to find out why a query running in my application (via JDBC) yields a different set of results from a direct query running on my Quest Central client for DB2.

    String query = "SELECT DISTINCT SYSTEM_NME FROM MISUSER.USAGE_LOGGER";

    try {
        Connection conn = DB2Connect.getDB2Connection();
        Statement stmt = conn.createStatement();

        ResultSet rs = stmt.executeQuery(query);
        while(rs.next()){
            retval.add(rs.getString(this.code.column_name));
        }

    } catch (SQLException e) {...

The above code returns a ResultSet object with 7 rows, while the same query executed on my db2 client returns more than 30 rows. As mentioned earlier, I have minimal experience with the database, and I need some idea how the same query can generate two different results.

+3
1

.

  • / .
  • ( DB2 ), JDBC , .
  • ​​ , .
+4

Source: https://habr.com/ru/post/1787537/


All Articles