I'm working with Datenwerke ReportServer. I'm trying to consume a Caché source via DJBC. Here is a blog post from them on adding additional databases. Unfortunately, I don't fully understand it. I have the JDBC file in the right place and I have created a groovy script for Caché which is below. The problem is related to the weird Query Wrapper thing it does. I can successfully test the datasource via the ReportServer UI, but when I try to execute a simple query, I get the following error:
Error
Query could not be prepared: Error preparing statement for executing the report query : SELECT * FROM (SELECT * FROM (SELECT TOP 10 * FROM HS_IHE_ATNA_Repository.Aggregation) wrappedQry) limitQry LIMIT 50 OFFSET 0 /* token: 6aab148a-927b-45d5-9dfd-724788e139ca / / currentuser: 3 */
cache.groovy
package databasehelper;
import net.datenwerke.rs.scripting.service.scripting.scriptservices.GlobalsWrapper;
import net.datenwerke.rs.base.service.dbhelper.DatabaseHelper
import net.datenwerke.rs.base.service.dbhelper.hooks.DatabaseHelperProviderHook
import net.datenwerke.rs.base.service.dbhelper.queries.Query
import net.datenwerke.rs.base.service.dbhelper.querybuilder.ColumnNamingService
import net.datenwerke.rs.base.service.dbhelper.querybuilder.QueryBuilder
class Cache extends DatabaseHelper {
public static final String DB_NAME = "Cache";
public static final String DB_DRIVER = "com.intersys.jdbc.CacheDriver";
public static final String DB_DESCRIPTOR = "DBHelper_Cache";
@Override
public String getDescriptor() {
return DB_DESCRIPTOR;
}
@Override
public String getDriver() {
return DB_DRIVER;
}
@Override
public String getName() {
return DB_NAME;
}
@Override
public String createDummyQuery() {
return 'SELECT * FROM HS_IHE_ATNA_Repository.Aggregation'
}
}
def HOOK_NAME = "DATASOURCE_HELPER_Cache"
def callback = [
provideDatabaseHelpers : {
return Collections.singletonList(new Cache());
}
] as DatabaseHelperProviderHook;
GLOBALS.services.callbackRegistry.attachHook(HOOK_NAME, DatabaseHelperProviderHook.class, callback)
Seems like a longshot posting this here, especially with
Notice generated query:
SELECT * FROM (SELECT * FROM
(SELECT TOP 10 * FROM HS_IHE_ATNA_Repository.Aggregation)
wrappedQry) limitQry LIMIT 50 OFFSET 0
Caché SQL does not support LIMIT
and OFFSET
.
%VID
and TOP
can be used in Caché SQL instead of LIMIT
/ OFFSET
:
http://docs.intersystems.com/cache20152/csp/docbook/DocBook.UI.Page.cls?KEY=GSQL_views#GSQL_C13474