This is the information I can glean so far. Still trying to get the exact version on the mainframe. (The select statement was improvised based on what Hibernate was generating, so please correct it if it was wrong.)
Here is the test code:
Code:
public void testSelectRowNumberOver() throws Exception {
DataSource ds = (DataSource) _lookup("jdbc/FssMidDataSource");
assertNotNull("DataSource can't be null", ds);
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
DatabaseMetaData metadata = conn.getMetaData();
_LOGGER.info(
"databaseProductName: " + metadata.getDatabaseProductName());
_LOGGER.info(
"databaseProductVersion: " + metadata.getDatabaseProductVersion());
_LOGGER.info("driverName: " + metadata.getDriverName());
_LOGGER.info("driverVersion: " + metadata.getDriverVersion());
_LOGGER.info("driverMajorVersion: " + metadata.getDriverMajorVersion());
_LOGGER.info("driverMinorVersion: " + metadata.getDriverMinorVersion());
String q1 = "select * from TFSDB01.SESN_STA_REF";
String q2 =
"select * from"
+ " ( select rownumber() over() as row_, this.*"
+ " from TFSDB01.SESN_STA_REF this )"
+ " as temp_ where row_ <= 20";
_LOGGER.info("executing first query [" + q1 + "]...");
ResultSet rs1 = stmt.executeQuery(q1);
rs1.close();
_LOGGER.info("executing second query [" + q2 + "]...");
ResultSet rs2 = stmt.executeQuery(q2);
_LOGGER.info("closing resources...");
rs2.close();
stmt.close();
conn.close();
}
And the result:
Code:
INFO common.DatabaseConnectivityTest - databaseProductName: DB2
INFO common.DatabaseConnectivityTest - databaseProductVersion: 07.01.0001
INFO common.DatabaseConnectivityTest - driverName: IBM DB2 JDBC 2.0 Type 2
INFO common.DatabaseConnectivityTest - driverVersion: 07.02.0000
INFO common.DatabaseConnectivityTest - driverMajorVersion: 7
INFO common.DatabaseConnectivityTest - driverMinorVersion: 1
INFO common.DatabaseConnectivityTest - executing first query [select * from TFSDB01.SESN_STA_REF]...
INFO common.DatabaseConnectivityTest - executing second query [select * from ( select rownumber() over() as row_, this.* from TFSDB01.SESN_STA_REF this ) as temp_ where row_ <= 20]...
DEBUG util.StringUtil - >exceptionToString = [COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2] SQL0104N An unexpected token "(" was found following "". Expected tokens may include: ", FROM INTO ". SQLSTATE=42601
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:260)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:197)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:448)
at COM.ibm.db2.jdbc.app.DB2Statement.execute2(DB2Statement.java:449)
at COM.ibm.db2.jdbc.app.DB2Statement.executeQuery(DB2Statement.java:369)
at com.ibm.ejs.cm.proxy.StatementProxy.executeQueryCommon(StatementProxy.java:368)
at com.ibm.ejs.cm.proxy.StatementProxy.executeQuery(StatementProxy.java:331)
at ....
[/code]