Use the <tsx:dbquery> tag to establish a connection to a database, submit database queries, and return the results set.
The <tsx:dbquery> tag does the following:
This section describes the syntax of the <tsx:dbquery> tag.
<%-- 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:
Represents the identifier of this query. The scope is the JSP file. Use id to reference the query. For example, from the <tsx:getProperty> tag, use id to display the query results.
The id is a tsx reference to the bean and can be used to retrieve the bean from the page contect. For example, if id is named mySingleDBBean, instead of using:
Select FNAME, LNAME AS FirstName, LastName from Employee where FNAME='Jim'
Represents the identifier of a <tsx:dbconnect> tag in this JSP file. The <tsx:dbconnect> tag provides the database URL, driver name, and optionally, the user ID and password for the connection.
Represents an optional attribute that constrains the maximum number of records returned by a query. If this 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.
Represents the only valid SQL command, SELECT. The <tsx:dbquery> tag must return a results set. Refer to your database documentation for information about the SELECT command. See other articles in this section for a description of JSP syntax for variable data and inline Java code.