Aug 09, 2022, 10:02 PM

News: - Used by 85,000 Members - SMS Backed up 7,35,000 - Contacts Stored  28,850 !!

JDBC Interview Questions

Started by nithyasubramanian, Jan 16, 2009, 02:58 AM

previous topic - next topic
Go Down


JDBC Interview Questions

1)   Explain in detail about JDBC and its general features?
JDBC defines the connectivity pattern between the client and his route to database. Querying and updating method is provided in JDBC. It is primarily based on RelationalDBMS. It is a part of the Java Standard edition. JDBC classes are present in the Java package.

2)   Explain about multiple implementations and drive manager?
JDBC is liberal in the usage and representation of multiple implementations in the same application. It provides a feature by which it allows loading of correct Java packages and registering them with Driver manager. A Driver manager is primarily responsible for creating JDBC connections.

3)   What are the different types of JDBC drivers?
There are many implementations of JDBC drivers out of which some types are: -
•   Drivers which implement JDBC API as mapping to another data access API.
•   Drivers written in Java programming and in native code.
•   Drivers which communicate with middle ware server using database independent protocol.
•   Drivers which implement network protocol and are present in pure Java.

4)   What are the different classes through which JDBC represents statements?
Statements are represented in JDBC using one of these classes: -
•   Statement
•   PreparedStatement
•   CallableStatement
Stored procedures can also be invoked through JDBC.

5)   Explain what should be done when a SQL exception is raised?
SQL exception is raised when a data base operation fails. The chances of recovering the lost database is meager apart from logging the file with much detail one can translate the SQL exception into application domain which will eventually result in a roll back which may solve the problem to a certain extent.

6)   Explain about the drive manager class working?
To manager a set of drivers available to JDBC a driver manager class needs to work with Driver interface. When a client requests for a specific connection by providing a URL it is the responsibility of driver manager to find a driver which can recognize that particular URL and that URL should be used for connecting to a database.

7)   Why do you use a data source object for a connection?
Data source object uses a logical name for a data source and this feature increases application portability. This removes the necessity of supplying information to each and every driver. Data source can be configured manually or automatically.

8)   State the three different ways in which you can create a table?
Tables can be created in three different ways they are: -
1)   Using IDE graphical interface
2)   Using ANT framework
3)   JDBC SQL written into a framework.

9)   Explain the process of creating tables using NetBeans IDE?
Although Vendors provide specific GUI which can create tables, they can also be created using NetBeans IDE. Databases can be created either through pull-down menu or by right clicking database. Clicking on the Tables icon select BBB create table. Changes can be made to that specific table by right clicking on them.

10)    How do you determine the sensitivity of the ResultSet object?
Sensitivity of ResultSet object is determined in three ways they are: -
1)   TYPE_FORWARD_ONLY: -It contains rows which satisfied the query. These rows are satisfied either at the time of execution or as the rows are retrieved.
2)   TYPE_SCROLL_INSENSITIVE: - Here the cursor can move forward backward or to an absolute position.
3)   TYPE_SCROLL_SENSITIVE: - This works in the same way as the Scroll insensitive.

11)    Explain about column name and getter method?
Getter methods have column names as inputs and they are case sensitive. In case a column has more than one name or similar names it considers the value of the first name and it returns search for the first name only. If columns are not explicitly named then it searches with the numbering.

12)    Give an example for getXXX method?
This command retrieves the value present in each column. Consider you created a table with name KAR_NAME the first column present in each row stores a value of SQL type VARCHAR. Usual method which can be used for retrieving a value of SQL type varchar or (variable character) is getstring.

13)    What are the methods which can verify about the cursor particular position?
In addition to these methods there are other four methods which let you verify the position of the cursor they are isFirst, isLast, isBeforeFirst, isAfterLast. All these methods return a Boolean statement which allows them to be used in a conditional statement.

14)    Does JDBC support stored procedures?
Stored procedures form a logical unit which executes certain statements in a predefined format or logic. Most of the DBMS support Stored procedures. A fair amount of variation in the syntax is present. A stored procedure can be invoked from JDBC.

15)    Explain about Join?
Join is very important in JDBC. It joins two or more tables in the database by the commonly shared values present in them. Tables should be created and they should have a common value present in them for joining. You can precede the column name with the table name which gets you your desired table.

16)    Explain about the main method?
For a class to get executed it should contain static public main method. This method also allows you to invoke other methods. When we define classes we not only want other classes to follow it but it should also execute. This is the centralized idea behind main method.

17)    Explain about the Try Block?
Try and Catch blocks are primarily used for handling exception. Java wants a mechanism which can handle when an exception is thrown. Try block spots the exception and hands it over to catch block which process the exception and deals with it appropriately. Try block contains classes and logic inside it.
Thanks and Regards
- Nithya Subramanian
Kenvivo Communications

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Gift your Kids Memories :: Book Website @ 349 Rs monthly
Copyright © 2005 - 2021 :: IT Acumens :: All Rights Reserved. :: XML Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Pro Dedicated Server

My Kids Diary