1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

JDBC interview questions

  • Image upload from JSP to DataBase ? view answer
  • How to Upload Image into Data Base ? view answer
  • Q. What is Rowset ? CachedRowSet,JDBCRowSet and WebRowSet ? view answer
  • Q. What is Batch Updates Using Statements in JDBC ? view answer
  • Q.Handling Blob and CLOB data using JDBC ? Insert CLOB and Retrive CLOB , Convert into String ? view answer
  • Q. Calling Stored procedures with Callable Statement ? view answer
  • Q.What is JDBC ? Explain Types Of Drivers with Advantage and Disadvantage ? view answer
  • Q. How java retrive the result returns from stored procedure ? view answer
  • Q.How to retrive the results in java returned by refcursor in Stored procedure ? view answer
  • Q.Reading an Oracle ARRAY from a stored procedure as an out ? view answer
  • What is Metadata and why should I use it? view answer
  • How Class.forName() load the Driver and DriverManager.getConnection() return connection? view answer
  • What will Class.forName do while loading drivers? view answer
  • How to Determining If a Result Set Is Scrollable? view answer
  • How Getting the Number of Rows in a Table Using a Scrollable Result Set? view answer
  • What is Scrollable Result Set ? view answer
  • What does setAutoCommit do? view answer
  • What is the difference between TYPE_SCROLL_INSENSITIVE , and TYPE_SCROLL_SENSITIVE? view answer
  • How to Make Updates to Updatable Result Sets? view answer
  • How can you move the cursor in scrollable result sets? view answer
  • What are the different types of Statements with Example? view answer
  • How can you retrieve data from the ResultSet? view answer
  • How can you create JDBC statements and what are they? view answer
  • How can you make the connection? view answer
  • What will Class.forName do while loading drivers? view answer
  • How can you load the drivers? view answer
  • What is PreparedStatement ? view answer
  • what is rowset? and how does it differ from resultset ? view answer
  • How to find total column from a resultset? view answer
  • What is the fastest type of JDBC driver? view answer
  • What are the different JDB drivers available? view answer
  • Q.What are collection pools? What are the advantages? view answer
  • Q.What are different types of Transaction Isolation Levels? view answer
  • Q. What is Dirty read? view answer
  • Q.Difference between Statement , PreparedStatement and CallableStatement ? view answer
  • Q.What is the advantage of using PreparedStatement? view answer
  • Q.What is Single-Phase Commit ? view answer
  • Q.What is two-phase commit? view answer
  • Q. How JDBC work with REF CURSOR returned by stored procedure and retrive results? view answer
  • Q. How do i get result return from stored procedure in JDBC? view answer
  • Q.How do you call a Stored Procedure from JDBC? view answer
  • Q.How do you handle your own transaction ? view answer
  • Q.What are the steps in the JDBC connection? view answer

!!! JDBC interview questions !!!

What will Class.forName do while loading drivers?

These are the steps happing inside
Step 1.
Class.forName("com.mysql.jdbc.Driver") load the Driver.
Step 2.
In the com.mysql.jdbc.Driver class there is static bock . That will execute because of static bock.
DriverManager.registerDriver(new Driver());
catch(SQLException E)
throw new RuntimeException("Can't register driver!");
This static block call DriverManager.registerDriver(new Driver());

Step 3.
Inside DriverManager.registerDriver() method.
public static synchronized void registerDriver(java.sql.Driver driver)
    throws SQLException {
    DriverInfo di = new DriverInfo();
    di.driver = driver;
    di.driverClass = driver.getClass();
    di.driverClassName = di.driverClass.getName();
    println("registerDriver: " + di);

DriverManager class create a Vector name drivers and add the Driver class to the vector.
Now In the Vector we have com.mysql.jdbc.Driver object.

Step 4.
To get connection we can
Connection con = DriverManager.getConnection(?jdbc:mysql://localhost:3306/testDB?,?username?,?password?);
In this method , it search the Driver in the vector , if available then connect and return connection.
for (int i = 0; i < drivers.size(); i++) {
     DriverInfo di = (DriverInfo)drivers.elementAt(i);
// if ?jdbc:mysql? keywork withic in input , match with the driver in the vector {
Connection result = di.driver.connect(url, info);

Return connection;
This class getting jdbc:mysql://localhost:3306/testDB as input . This class check for the driver based on ?jdbc:mysql? in this case and connect the driver.

Reviews and Comments

PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2019

About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy