Databases Reference
In-Depth Information
A statement is most easily thought of as an SQL statement, such as SELECT *
FROM Employee . However, a statement is more than just an SQL statement—
it consists of all of the information associated with that SQL statement, such as
any result sets created by the statement and parameters used in the execution
of the statement. A statement does not even need to have an application-
defined SQL statement. For example, when a catalog function such as
SQLTables is executed on a statement, it executes a predefined SQL statement
that returns a list of table names. 1
To summarize, a statement is not only the request sent to the database but
the result of the request.
How One Connection for Multiple Statements Works
Note
Because of the architecture of the ADO.NET API, this connection model
typically does not apply.
When you develop your application to use one connection for multiple
statements, an application may have to wait for a connection. To understand
why, you must understand how one connection for multiple statements works;
this depends on the protocol of the database system you are using: streaming or
cursor based. Sybase, Microsoft SQL Server, and MySQL are examples of stream-
ing protocol databases. Oracle and DB2 are examples of cursor-based protocol
databases.
Streaming protocol database systems process the query and send results
until there are no more results to send; the database is uninterruptable.
Therefore, the network connection is “busy” until all results are returned
(fetched) to the application.
Cursor-based protocol database systems assign a database server-side
“name” (cursor) to a SQL statement. The server operates on that cursor in incre-
mental time segments. The driver tells the database server when to work and
how much information to return. Several cursors can use the network connec-
tion, each working in small slices of time.
1 Microsoft ODBC 3.0 Programmer's Reference and SDK Guide , Volume I. Redmond: Microsoft Press,
1997
Search WWH ::




Custom Search