Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Download the Database Connector Tutorial application. This application contains all of the example forms used in this tutorial. This download is a  application zip file that you can uploaded upload into your user account. See Application Home Page documentation for more information on uploading this application zip file.

...

The first step is to define a queryset and give it a name - BIRT in the configuration.xml file. Since we are using the built-in configuration.xml file, you do not have to do this. Here is an example of the BIRT queryset and the "allCustomers query that is described below.

Code Block
 <query <dbconnector>
    <queryset name="BIRT">
         <query name="allCustomers" autocreate="true">
            <retrieve>
                <statement>
                    SELECT "customerNumber","customerName" from "Customers" order by "customerName"
                </statement>
            </retrieve>
        </query>
    </queryset>
</dbconnector>

The database connector can simultaneously connect to multiple databases; each must be defined in its own queryset. The queryset consists of a resource definition and any number of named queries. The resource definition is shown above for MySQL It is configured in the dbconnector-custom.properties file. You will need to modify it as required: change localhost to the name of the machine running MySQL, specify the MySQL driver, change the database user name and password.

...

  • The 'localhost:8082' is obvious and points to the database connector inside a the tomcat servlet container (e.g. Tomcat) on localhost and listening on port 8082.
  • 'database' refers to the context path for the database connector web application running inside Tomcat.
  • 'BIRT' refers to the name of the queryset defined above.
  • 'allCustomers' is the name of the query.
  • Since we are issuing an HTTP GET from the browser, this maps to the <retrieve> SQL.
  •  _mediaType=xml tells the connector to return an XML document. This is the default; if you leave out a _mediaType, the connector will return XML. When the HTTP GET is issued, the connector executes the <retrieve> SQL for the 'allCustomers' query in the 'BIRT' queryset using the resource definition to connect to the appropriate database. The data in the resultset is converted to XML and returned.

...

If you prefer, you can generate the schema for the entire BIRT queryset before you begin. This eliminates the need to create a schema one by one for each query as specified in the instructions. The queryset schema can be uploaded to your application one time and then you can add the relevant schema elements to your forms/flows as you need them. Browse this URL to get the schema, save the schema as an .xsd file in your file system then upload the schema to Live Forms.

 

Code Block
http://<server>:<port>/database/BIRT/schema

 

...