Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements


Creates or replaces an OData Producer.

CREATE [ OR REPLACE ] ODATA PRODUCER name [ producer-clause... ]
[ ADMIN USER { NULL | user } ]
[ MODEL [ FROM ] { FILE string-or-variable [ ENCODING string ] | VALUE { NULL | string-or-variable [ ENCODING string ] } } ]
  [ SERVICE ] ROOT string
[ USING string ]
  • ADMIN USER clause Specifies an administrative user that the OData Producer uses to create tables, a procedure, and an event to manage repeatable requests. The user must have the CREATE TABLE, CREATE PROCEDURE, VERIFY ODATA, and MANAGE ANY EVENT system privileges. This user cannot be the same user as specified in the AUTHENTICATION clause.

    Specifies how the OData server connects to the database. The default setting, DATABASE, allows users to connect with personalized credentials. These credentials are requested using Basic HTTP authentication.

    Specify USER for all users to connect using the credentials of the specified user. The specified user must have the VERIFY ODATA system privilege. USER is recommended for testing and read-only producers. See OData server security considerations for more information.

  • ENABLED clause Specifies whether this OData Producer is enabled or disabled. By default, OData Producers are enabled.
  • MODEL clause

    Specifies the OData Producer service model (given in OSDL), that indicates which tables and views are exposed in the OData metadata. If you specify the FILE clause, then the value must be a variable or string of the file name that contains the OSDL data. If the file name is not fully qualified, then the path is relative to the database server's current working directory. If the file name is specified, then the file is read and the contents of the file are stored in the database and logged in the transaction log. By default, tables and views are exposed based on user privileges. Tables and views without primary keys are not exposed.

    Use the ENCODING clause to specify the character set of the model data or file. The default is UTF-8.

  • SERVICE ROOT clause

    Specifies the root of the OData service on the OData server. All resources for the OData Producer are accessed by using URIs of the following format: scheme:host:port/path-prefix/resource-path[query-options].

    The SERVICE ROOT clause is /path-prefix. The value must be specified, it cannot be NULL and must start with /.

  • USING clause

    Specifies additional OData Producer options. Options are specified in a semicolon-separated list of name=value pairs.

    Option Description
    ConnectionPoolMaximum = num-max-connections

    Indicates the maximum number of simultaneous connections that this OData Producer keeps open for use in the connection pool.

    Fewer connections might be used by the connection pool depending on the OData server load.

    By default, the connection pool size is limited to half of the maximum number of simultaneous connections that the database server supports.

    CSRFTokenTimeout = num-seconds-valid

    Enables CSRF token checking and specifies the number of seconds that a token is valid for.

    By default, this value is 0, which disables CSRF token checking. Otherwise, the number of seconds must be a valid integer value from 1 to 1800.

    PageSize = num-max-entities

    Specifies the maximum number of entities to include in a retrieve entity set response before issuing a next link.

    The default setting is 100.

    ReadOnly = { true | false }

    Indicates whether modification requests should be ignored.

    The default setting is false.

    RepeatRequestForDays = { days-number }

    Specifies how long repeatable requests are valid.

    This value must be an integer ranging from 1 to 31.

    The default setting is 2.

    This option is only effective when the ADMIN USER clause is not NULL.

    SecureOnly = { true | false }

    Indicates whether the Producer should only listen for requests on the HTTPS port.

    The default setting is false.

    ServiceOperationColumnNames = { generate | database }

    Specifies whether the column names in the metadata should be generated or taken from the result set columns in the database when naming the properties of the ComplexType used in the ReturnType.

    The default setting is generate.


Creates and starts an OData Producer. The OData Producer is started only if it is enabled and the database was started on a server with the -xs ODATA database server option.

When a database is started on a database server that was started with the -xs ODATA database server option, then all enabled OData Producers are started on the database server.


You must have the MANAGE ODATA system privilege.

If you specify the AUTHENTICATION USER clause or the ADMIN USER clause, then the specified users must have the VERIFY ODATA system privilege.


The following example shows how to create an OData Producer:

    ADMIN USER SuperODataUser
    MODEL FILE '../../ordermodel.osdl'
    SERVICE ROOT '/orders/'
    USING 'ConnectionPoolMaximum=10;CSRFTokenTimeout=600;PageSize=100;