Dynamic Database Access
So
far, we
have dealt with applications in which you know exactly what needs to
be done at compile time. If this were the only kind of database
support that JDBC provided, no one could ever write tools like the
mysql interactive command-line tool that
determines SQL calls at runtime and executes them. The JDBC
Statement
class provides the execute(
)
method for executing SQL that can
be either a query or an update. Additionally,
ResultSet
instances provide runtime information
about themselves in the form of an interface called
ResultSetMetaData
, which you can access via the
getMetaData( )
call in the
ResultSet
.
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.