To retrieve a description of a given table column’s privileges—that is, its access rights—you can use the DatabaseMetaData interface’s getColumnPrivileges() method. This method returns a list of columns and associated privileges for the specified table. The getColumnPrivileges() method returns the result as a ResultSet, where each row is a column privilege description. In production applications, returning the result as a ResultSet is not that useful. It is better to return the result as XML so that the client application can extract the required information and display it in a desired fashion. Note that this privilege does not apply to all columns—this may be true for some systems, but it is not true for all.
The getColumnPrivileges() method retrieves a description of the access rights for a table’s columns. Only privileges matching the column name criteria are returned. They are ordered by COLUMN_NAME and PRIVILEGE.
Each privilege description has the columns shown in Table .
Table . Columns for Result of getColumnPrivileges()
public ResultSet getColumnPrivileges(String catalog,
Here are the parameters for the getColumnPrivileges() method:
The Solution: Get Table Column Privileges/**
Oracle:Test the Solution: Get Table Column Privileges
I tested getColumnPrivileges() for several Oracle tables, but I could not get any results (it seems that the Oracle driver does not support this feature at all).
The client call looks like this:String columnPrivileges = DatabaseMetaDataTool.getColumnPrivileges
MySQL: Test the Solution: Get Table Column PrivilegesThe client call looks like this:
The output is---- Table Column Privileges ----
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.