A database column’s privileges refers to finding a description of the access rights for columns of a table available in a catalog or schema. DatabaseMetaData provides a method, getColumnPrivileges(), to do just that. This method returns the result as a ResultSet object where each row is a column privilege description. In web-based applications, returning the result as a ResultSet is not useful. It is better to return the result as an HTML/XML object so that the client can extract the required information and display it in a desired format. It would be wrong to assume that this privilege applies to all columns; while this may be true for some systems, it is not true for all.
getColumnPrivileges() returns only privileges that match the schema and table name criteria. They are ordered by COLUMN_NAME and PRIVILEGE. Each privilege description has the columns shown in Table.
Table : Columns for Result of Invoking getColumnPrivileges()
The getColumnPrivileges() method has the following signature:
Next let’s look at a Java servlet, GetTablePrivileges, which has the following signature:
Invoking GetColumnPrivileges for MySQL
Figure: shows how to run the solution for the MySQL database.
Invoking GetColumnPrivileges for Oracle
Figure : shows how to run the solution for the Oracle database. As you can observe, Oracledriver does not implement the getColumnPrivileges() method.
JDBC Related Interview Questions
|Core Java Interview Questions||JSP Interview Questions|
|Java Servlets Interview Questions||EJB(Enterprise JavaBeans) Interview Questions|
|JSTL(JSP Standard Tag Library) Interview Questions||JNDI (Java Naming and Directory Interface) Interview Questions|
|Java Bean Utils Interview Questions||AWT (Abstract Window Toolkit) Interview Questions|
What Is Jdbc Programming?
Database Metadata, Part 1
Database Metadata, Part 2
Exploring Driver Property Information
Rowset Metadata A
Web Access To Metadata,part 1
Web Access To Metadata, Part 2
Rdf And Jdbc Metadata
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.