Open topic with navigation

TIBCO BusinessEvents® Enterprise Edition 6.3.1

# createQuery()

You can open a database cursor for an SQL query by using the `Database.createQuery()` function. Once the cursor is open, you can retrieve large result sets from the database in pages.

## Syntax

    String createQuery(String jdbcURI, String cursorName, String resultTypeURI, String sql, int pageSize, Object requestObj);

## Parameters

Parameter | Type | Description
--- | --- | ---
`jdbcURI` | `String` | The JDBC URI of the resource to be used for getting the connection.
`cursorName` | `String` | The name of the cursor to be opened.
`resultTypeURI` | `String` | The URI of the result type, which will be returned by the query. Possible values are Concept URI, Map, or Null. If it is of "Map" type, then each result set row is a Map object. In this case, you can retrieve the column values by specifying column names as the key. If Null, an `Object[]` is returned.
`sql` | `String` | The SQL query string. It can be a prepared statement query or a simple statement query.
`pageSize` | `Integer` | The number of concepts or records to be fetched from the database for each page.
`requestObj` | `Object` | If the SQL query specified is a prepared statement query, then the `requestObject` can be specified as a concept or an array of arguments.
`returns` | `String` | The name of the opened cursor.

## Example

    Database.setCurrentConnection("/SharedResources/Oracle.sharedjdbc");
    String jdbcURI="/SharedResources/HR_DB_Conn.sharedjdbc";
    String cursorName="EmpCursor";
    String resultTypeURI="/Concepts/HR/EMPLOYEES";
    String sql="select * from employees";
    int pageSize=10;
    Object requestObj=null;
    String cursorName=Database.createQuery(jdbcURI,cursorName,resultTypeURI,sql,pageSize,requestObj);
    System.debugOut(" Opened Cursor: " + cursorName);

Did you find this helpful?

YesNo
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO BusinessEvents® Enterprise Edition

Copyright © 2004-2024. Cloud Software Group, Inc. All Rights Reserved.