DatabaseMetaData has four driver-related methods, which are discussed in this
section. We will combine all of them into a single method called
getDriverInformation() and return the result as XML (serialized as a String object).
DatabaseMetaData Methods Supporting Driver Information
int getJDBCMajorVersion()// Retrieves the major JDBC version number for this driver.
The solution is generic enough and can support MySQL, Oracle, and other relational databases./**
To get the driver information (such as the name and version), we call the methods (listed earlier) and the result is returned as XML. The advantage of our solution is that you get the required information with a single call and the result (as XML) can be used by any kind of client. Note that
oracle.jdbc.OracleDatabaseMetaData.getJDBCMinorVersion() are unsupported
features; therefore, we have to use a try-catch block. If the method returns a SQLException, we return the message “unsupported feature” in the XML result. The driver information does not change frequently and therefore it can be cached in the server-side.
Client Using MySQLimport java.util.*;
Output Using MySQL-------- getDriverInformation ------
Client Using Oracleimport java.util.*;
Output Using Oracle
The following output is formatted to fit the page:-------- getDriverInformation ------
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.