InfoCenter Home >
4: Developing applications >
4.2: Building Web applications >
4.2.2: Developing JSP files >
4.2.2.3: Overview of JSP file content >
4.2.2.3.7: IBM extensions to JSP syntax >
4.2.2.3.7.2: JSP syntax: Tags for database access >
4.2.2.3.7.2.3: JSP syntax: <tsx:dbquery> tag syntax

4.2.2.3.7.2.3: JSP syntax: <tsx:dbquery> tag syntax

<%-- SELECT commands and (optional) JSP syntax can be placed within the tsx:dbquery. --%>
<%-- Any other syntax, including HTML comments, are not valid. --%>
<tsx:dbquery id="query_id" connection="connection_id" limit="value" >
</tsx:dbquery>
where:
  • id

    The identifier of this query. The scope is the JSP file. This identifier is used to reference the query, for example, from the <tsx:getProperty> to display query results.

    The id becomes the name of a bean that contains the results set. The bean properties are dynamic and the property names are the names of the columns in the results set. If you want different column names, use the SQL keyword for specifying an alias on the SELECT command. In the following example, the database table contains columns named FNAME and LNAME, but the SELECT statement uses the AS keyword to map those column names to FirstName and LastName in the results set:

    Select FNAME, LNAME AS FirstName, LastName from Employee where FNAME='Jim'
    
  • connection

    The identifier of a <tsx:dbconnect> in this JSP file. That <tsx:dbconnect> provides the database URL, driver name, and (optionally) the user ID and password for the connection.

  • limit

    An optional attribute that constrains the maximum number of records returned by a query. If the attribute is not specified, no limit is used. In such a case, the effective limit is determined by the number of records and the system caching capability.

  • SELECT command and JSP syntax

    The only valid SQL command is SELECT because the <tsx:dbquery> must return a results set. Refer to your database documentation for information about the SELECT command. See other sections of this document for a description of JSP syntax for variable data and inline Java code.

Go to previous article: JSP syntax: <tsx:userid> and <tsx:passwd> tag syntax Go to next article: Example: JSP  syntax: <tsx:dbquery> tag syntax

 

 
Go to previous article: JSP syntax: <tsx:userid> and <tsx:passwd> tag syntax Go to next article: Example: JSP  syntax: <tsx:dbquery> tag syntax