Hi All,
This is what I read from the Java Open Client Manual (page 65):
"In the Java Open Client, the default mechanism for passing either a single temp-table or a ProDataSet parameter (static or dynamic) is the OpenEdge ProDataGraph. An alternative mechanism for passing temp-tables (but not ProDataSets) is the SQL ResultSet interface, supported by the Java Database Connectivity (JDBC) standard. The SQL ResultSet provides a data streaming model for accessing temp-tables only and is the only mechanism for accessing complex data in the Java Open Client prior to OpenEdge Release 10.1A. This model works similar to a one-way tape reader or writer. It is provided mainly for backward compatibility."
I wrote a simple ABL Procedure that returns 5000 rows of data with two columns (one integer and one string).
When I mapped a ProDataSet output parameter to ProDataGraph on Java end, it took 1100 ms to get the results.
When I mapped a Temp-Table output parameter to a SQL ResultSet on Java end, it took 340 ms to get the results.
The results make sense because SQL ResultSet is just a data streaming model but a ProDataGraph is a full blown Object Tree representation of the same data.
Since the documentation says that "mapping temp-tables to SQL ResultSets is only provided for backward compatibility", I am a bit sceptical to use it. Does that mean this feature will be deprecated in near future?
My next question is regarding performance. An SQL query (executed through JDBC) that returns the same data takes 220 ms during the first run and just 80 ms during the second run. I am assuming that the improved performance during the second run is because the results of the first run are cached. However the ABL procedure (executed on AppServer using an Open Client architecture) takes 340 ms for the first run and 300 ms for the second run.
1) Will Open Client run slower than JDBC?
2) Why isn't there a significant improvement in performance for the second run for the State-Free Open Client program?
Thanks for reading. I appreciate your inputs.
Thanks,
Shashi
Environment: OpenEdge Architect 10.2 trial version
Code:
/* getall-fotos2.p */
DEFINE TEMP-TABLE ttFoto
FIELD fotonum LIKE foto.fotonum
FIELD fototitle LIKE foto.fototitle.
DEFINE OUTPUT PARAMETER TABLE FOR ttFoto.
FOR EACH foto NO-LOCK:
/* WoodpicsOpenClient.java */
package woodpics;
public class WoodpicsOpenClient {
private static woodpics.WoodpicsAppObject appObj = null;
private static com.progress.open4gl.javaproxy.Connection con = null;
public static void main(String[] args) {
This is what I read from the Java Open Client Manual (page 65):
"In the Java Open Client, the default mechanism for passing either a single temp-table or a ProDataSet parameter (static or dynamic) is the OpenEdge ProDataGraph. An alternative mechanism for passing temp-tables (but not ProDataSets) is the SQL ResultSet interface, supported by the Java Database Connectivity (JDBC) standard. The SQL ResultSet provides a data streaming model for accessing temp-tables only and is the only mechanism for accessing complex data in the Java Open Client prior to OpenEdge Release 10.1A. This model works similar to a one-way tape reader or writer. It is provided mainly for backward compatibility."
I wrote a simple ABL Procedure that returns 5000 rows of data with two columns (one integer and one string).
When I mapped a ProDataSet output parameter to ProDataGraph on Java end, it took 1100 ms to get the results.
When I mapped a Temp-Table output parameter to a SQL ResultSet on Java end, it took 340 ms to get the results.
The results make sense because SQL ResultSet is just a data streaming model but a ProDataGraph is a full blown Object Tree representation of the same data.
Since the documentation says that "mapping temp-tables to SQL ResultSets is only provided for backward compatibility", I am a bit sceptical to use it. Does that mean this feature will be deprecated in near future?
My next question is regarding performance. An SQL query (executed through JDBC) that returns the same data takes 220 ms during the first run and just 80 ms during the second run. I am assuming that the improved performance during the second run is because the results of the first run are cached. However the ABL procedure (executed on AppServer using an Open Client architecture) takes 340 ms for the first run and 300 ms for the second run.
1) Will Open Client run slower than JDBC?
2) Why isn't there a significant improvement in performance for the second run for the State-Free Open Client program?
Thanks for reading. I appreciate your inputs.
Thanks,
Shashi
Environment: OpenEdge Architect 10.2 trial version
Code:
/* getall-fotos2.p */
DEFINE TEMP-TABLE ttFoto
FIELD fotonum LIKE foto.fotonum
FIELD fototitle LIKE foto.fototitle.
DEFINE OUTPUT PARAMETER TABLE FOR ttFoto.
FOR EACH foto NO-LOCK:
CREATE ttFoto.
BUFFER-COPY foto TO ttFoto.
END.BUFFER-COPY foto TO ttFoto.
/* WoodpicsOpenClient.java */
package woodpics;
public class WoodpicsOpenClient {
private static woodpics.WoodpicsAppObject appObj = null;
private static com.progress.open4gl.javaproxy.Connection con = null;
public static void main(String[] args) {
try {
}con = new com.progress.open4gl.javaproxy.Connection("AppServerDC://localhost:3091/esbbroker1","shashi","password","");
con.setSessionModel(1);
//Create Sports AppObject to connect
appObj = new woodpics.WoodpicsAppObject(con);
System.out.println((String) appObj._getProcReturnString());
java.util.Scanner scanner = new java.util.Scanner(System.in);
getAllPhotos();
getAllPhotos();
} catch (com.progress.open4gl.Open4GLException ex) {con.setSessionModel(1);
//Create Sports AppObject to connect
appObj = new woodpics.WoodpicsAppObject(con);
System.out.println((String) appObj._getProcReturnString());
java.util.Scanner scanner = new java.util.Scanner(System.in);
getAllPhotos();
getAllPhotos();
System.out.println("Connection failed");
ex.printStackTrace();
} catch (java.io.IOException ex) {ex.printStackTrace();
System.out.println("IO Exception!");
ex.printStackTrace();
} finally {ex.printStackTrace();
if (appObj != null) {
try {
appObj._release();
} catch(com.progress.open4gl.SystemErrorException ex) {
ex.printStackTrace();
} catch(com.progress.open4gl.Open4GLException ex) {
ex.printStackTrace();
}
}
}try {
appObj._release();
} catch(com.progress.open4gl.SystemErrorException ex) {
ex.printStackTrace();
} catch(com.progress.open4gl.Open4GLException ex) {
ex.printStackTrace();
}
}
@SuppressWarnings("unchecked")
public static void getAllPhotos() throws com.progress.open4gl.Open4GLException, java.io.IOException {
com.progress.open4gl.ResultSetHolder resultSetHolder = new com.progress.open4gl.ResultSetHolder();
java.util.Date startTime = new java.util.Date();
appObj.getallFotos2(resultSetHolder);
java.util.Date endTime = new java.util.Date();
System.out.println("Successfull!!");
java.sql.ResultSet resultSet = resultSetHolder.getResultSetValue();
try {
int numFotos = 0;
while (resultSet.next()) {
int fotoNum = resultSet.getInt(1);
String title = resultSet.getString(2);
numFotos++;
//System.out.println(fotoNum + "\t" + title);
}
System.out.println("# Photos: " + numFotos);
} catch (Exception ignore) {
ignore.printStackTrace();
}
System.out.println("Time Taken: " + (endTime.getTime() - startTime.getTime()) + " ms");
java.util.Date startTime = new java.util.Date();
appObj.getallFotos2(resultSetHolder);
java.util.Date endTime = new java.util.Date();
System.out.println("Successfull!!");
java.sql.ResultSet resultSet = resultSetHolder.getResultSetValue();
try {
int numFotos = 0;
while (resultSet.next()) {
int fotoNum = resultSet.getInt(1);
String title = resultSet.getString(2);
numFotos++;
//System.out.println(fotoNum + "\t" + title);
}
System.out.println("# Photos: " + numFotos);
} catch (Exception ignore) {
ignore.printStackTrace();
}
System.out.println("Time Taken: " + (endTime.getTime() - startTime.getTime()) + " ms");
}
}