In general, when creating a database connection object (java.sql.Connection), most JDBC drivers should accept three connection properties:
Also, a JDBC driver may accept an arbitrary number of proprietary connection properties. For example, MySQL’s JDBC driver (for details on MySQL’s connection properties. can accept over a dozen additional connection properties, such as connectTimeout and use Compression. JDBC drivers can be interrogated for their supported connection properties using the DriverPropertyInfo metadata class. For specific database connection properties, you should consult the vendor’s JDBC driver documentation (this documentation should specify all properties and their role in creating the JDBC database connection).
This solution identifies which connection properties are required and which ones are optional:
Running the Solution for a MySQL Database
Because the output was long, I have edited it to fit the page:
Running the Solution for an ODBC Database
The JDBC-ODBC bridge driver does not properly return an array of DriverPropertyInfo objects, but instead throws either a NullPointer Exception or java.sql.SQLException:
Running the Solution for an Oracle Database
Oracle’s JDBC driver does not implement Driver.getPropertyInfo() properly. It just returns an empty array. Here is a section of code from Oracle’s JDBC driver:
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.