DataConnection dataConnection = null;
SQLCommand sqlCommand = null;
DataResult dataResult = null;
try {
//gets connection
DataSourceUtilities dsUtil = new DataSourceUtilities();
Connection conn = dsUtil.getConnection(profile,dataSource);
dataConnection = dsUtil.getDataConnection(conn);
sqlCommand = dataConnection.createSelectCommand(statement, false);
dataResult = sqlCommand.execute();
ScrollableDataResult scrollableDataResult = (ScrollableDataResult) dataResult.getDataObject();
SourceBean result = scrollableDataResult.getSourceBean();
resStr = result.toXML(false);