I have the Java code snippet:
import coldfusion.runtime.Struct;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.jdbc.OracleCallableStatement;
public class CursorTest {
public static Struct getCursor() throws SQLException {
OracleCallableStatement statement = null;
Struct variables = new Struct();
// prepare statement with a cursor out parameter
ResultSet results = statement.getCursor( 1 );
variables.put ( "cursor", results );
return variables;
}
}
Including the cfusion.jar
and the hotfix jars from the ColdFusion lib
directoy and Oracle's ojdbc6.jar
in the build path.
I can run it in ColdFusion:
<cfscript>
vars = createObject( 'java', 'CursorTest' ).getCursor();
cursor = createObject( 'java', 'coldfusion.sql.QueryTable' )
.init( vars.cursor )
.firstTable();
WriteDump( cursor );
// close the statement and connection.
</cfscript>
This works and the QueryTable
is created.
However, trying to move the generation of the QueryTable
into the Java code:
import coldfusion.runtime.Struct;
import coldfusion.sql.QueryTable;
import coldfusion.sql.Table;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.jdbc.OracleCallableStatement;
public class CursorTest {
public static Struct getCursor() throws SQLException {
OracleCallableStatement statement = null;
Struct variables = new Struct();
// prepare statement with a cursor out parameter
ResultSet results = statement.getCursor( 1 );
Table table = new QueryTable( results ).firstTable();
variables.put ( "cursor", table );
return variables;
}
}
Fails to build with:
error: cannot access QueryTableWrapper
Table table = new QueryTable( results ).firstTable();
^
class file for coldfusion.runtime.QueryTableWrapper not found
Now, the error is self explanatory and unpacking the Jar files shows that that file is not there ... however, I cannot find it in any of the other Jar files that are in the ColdFusion lib directory, ColdFusion's JRE directory or other Jars that might be on ColdFusion's class path.
Does anyone know where this file is located so I can include it on the build path or, alternatively, how ColdFusion manages to generate the QueryTable
using createObject
without that wrapper?