The Tutorial illustrate a program that helps you to understand JDBC Get Metadata.The Tutorial illustrate a program that helps you to understand JDBC Get Metadata.
JDBC Get Metadata is the collective data structure, data type and properties of a table. In this Tutorial we want to explain the database table person. The Get Metadata provides you the information about the column name and its data type of each column.
Understand with Example
In this Tutorial we want to describe a code that helps you in understanding a JDBC Get Metadata. The code include a class Jdbc Get Metadata, Inside the class we have a list of method that return you the information of Metadata are as follow -
Before implementation of class, we import a package name java.sql,enables network interface between front end application and backend database.
|DriverManager.getConnection ( )||Return you an object of connection, that helps in built a connection between url-database.|
|createStatement ( )||Return you a SQL object, An object of connection class is used to execute and send queries in the database.|
|executeQuery ( )||This method returns the record set from a table. The record set is assigned to a result set. The sql select statement is used to retrieve the records from a table in the database.|
|getMetaData ( )||This method return the number, type and properties of the result set object|
|get column count ( )||This method return you the number of column in the Table Person|
.Finally the println print the name of the table, column name, column size and data type in the output. In case there is an exception in the try block, the catch block check the exception and handle it.JdbcGetMetadata.java
Table Name : person Field size DataType id 2 VARCHAR cname 50 VARCHAR dob 10 DATE