ResultSetMetaData in JDBC || ResultSetMetaData''s methods || CS506-17.1
Автор: LEarn TOgether
Загружено: 2022-06-19
Просмотров: 1049
metadata is any data that describes the book—including
title
subtitle
price
publication date
ISBN
and any other relevant information that readers use to find the book.
ResultSet Metadata:
ResultSet Meta Data will help you in answering such questions :
How many columns are in the ResultSet?
What is the name of given column?
Are the column name case sensitive?
What is the data type of a specific column?
What is the maximum character size of a column?
Can you search on a given column?
Creating ResultSetMetaData object:
From a ResultSet (the return type of executeQuery()), derive a ResultSetMetaData object by calling getMetaData() method as shown in the given code snippet
(here rs is a valid ResultSet object):
ResultSetMetaData rsmd = rs.getMetaData();
Now, rsmd can be used to look up number, names & types of columns.
Useful ResultSetMetaData methods:
getColumnCount ( ):
Returns the number of columns in the result set.
getColumnDisplaySize (int):
Returns the maximum width of the specified column in characters.
getColumnName(int):
Returns the database name of the column.
getColumnLabel (int):
Returns the suggested column label for printouts.
getColumnType (int):
Returns the SQL type for the column to compare against types in
“java.sql.Types”
#learntogether
#cs506
#javaprogramming
#jdbc
#jdbcconnectivity
#resulset
#metadata
#methods
#java
#javadatabaseconnectivity
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: