Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.57 KB

using-database-metadata.md

File metadata and controls

26 lines (18 loc) · 1.57 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic
Using database metadata
Learn how to access and navigate database metadata when using the Microsoft JDBC Driver for SQL Server.
David-Engel
davidengel
03/26/2021
sql
connectivity
conceptual

Using database metadata

[!INCLUDEDriver_JDBC_Download]

To query a database for information about what it supports, the [!INCLUDEjdbcNoVersion] implements the SQLServerDatabaseMetaData class. This class contains many methods that return information in the form of a single value, or as a result set.

To create a SQLServerDatabaseMetaData object, you can use the getMetaData method of the SQLServerConnection class to get information about the database that it's connected to.

In the following example, an open connection to the [!INCLUDEssSampleDBnormal] sample database is passed in to the function. Then the getMetaData method of the SQLServerConnection class is used to return a SQLServerDatabaseMetadata object. Finally, various SQLServerDatabaseMetaData methods are used to display information about the driver, driver version, database name, and database version.

[!codeJDBC#UsingDBMetaData1]

See also

Handling metadata with the JDBC driver