
 |
 |
WebGroove is no longer supported. These docs are reference only. |
|

|

Reusing Database Connections
By default, each sql tag in a script has its own database connection. This connection is opened when the query is performed and closed when the query is complete. For most scripts, which have only one or two queries, this approach is fine. However, scripts which use numerous or nested queries can benefit from reusing named database connections.

You name a database connection by using the dbcon option in a sql tag. Instead of being closed when the query is finished, that connection will remain open. You can reuse it by specifying the same dbcon name in another sql tag. For example:

<sql detail = category dbcon = con1>
select * from category
order by title
</sql>

<sql detail = company
dbcon = con1>
select * from company
where state = 'TX'
order by name
</sql>

In this case, both sql tags use the connection named con1. This saves the overhead of opening and closing two different database connections, and can improve performance. Named connections will automatically be closed when the script is finished.
 Up To
 Sql Tag
 WebGroove® is a registered trademark of Creativision Publishing Corporation
|
 |
 |
 |
|

|