- World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.

Get it now !!
Send your Resume to 6000 Companies
JDBC Interview Questions & Answers - Learning Mode

JDBC Interview Questions & Answers - Learning Mode

Java Database Connectivity (JDBC) is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases.

Try JDBC Interview Questions & Answers - Exam Mode

1 2 3 4 5 6 7 8 9 10 11 Next

Sort By : Latest First | Oldest First | By Rating

JDBC Interview Questions & Answers - Learning Mode
Try JDBC Interview Questions & Answers - Exam Mode
Question: What is Connection Pooling?

Answer: With servlets, opening a database connection is a major bottleneck because we are creating and tearing down a new connection for every page request and the time taken to create connection will be more.

Creating a connection pool is an ideal approach for a complicated servlet. With a connection pool, we can duplicate only the resources we need to duplicate rather than the entire servlet. A connection pool can also intelligently manage the size of the pool and make sure each conne Source:
Question: Which of the following allows non repeatable read in JDBC, connection class?

Question: The full form of ODBC is ___________

Question: How can I protect my database password ? I'm writing a client-side java application that will access a database over the internet. I have concerns about the security of the database passwords. The client will have access in one way or another to the class files, where the connection string to the database, including user and password, is stored in as plain text. What can I do to protect my passwords?

Answer: This is a very common question.
Conclusion: JAD decompiles things easily and obfuscation would not help you. But you'd have the same problem with C/C++ because the connect string would still be visible in the executable.
SSL JDBC network drivers fix the password sniffing problem (in MySQL 4.0), but not the decompile problem. If you have a servlet container on the web server, I would go that route (see other discussion above) then you could at least keep people from reading/destroying y Source:
Question: what is different between tier and 3 tier?

Answer: Question is not correct
if question is 1-tier and 3-tier
then answer his one tier means stand Alon program their is no layers. means program in simple Jsp page with data base connection and display means business logic,view,and their is no back end storage,
3-tier means: separation of front end, business logic, database storage,
Three Layered Application
Question: What is hybernate and spring? can u suggest any books or documents so that i can go through?

Answer: Hibernate offers persistence and OR(Objet-Relational) mapping for Java/J2EE applications helping them improve performance and scalability.

Spring is a light-weight Java framework which paves the way to write faster applications without App Server (or EJB etc.)

There are a plenty of good books on these subjects. Following the most notable amongst them:

Hibernate in Action by Christian Bauer, Gavin King (Hanning)

Better, Faster, Lighter Java by Justin Gehtland, Bruce A. Source:
Question: State true or false :- ResultSet.CONCUR_UPDATABLE used with the result set is used to update the rows directly in the database.

Answer: True

Explanation: This is the new feature in the JDBC 2.0 API usage is Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
Question: State true or falseCan we retrieve a whole row of data at once, instead of calling an individual ResultSet.getXXX method for each column ?

Answer: we cannot retrieve a whole row of data at once.

In JDBC getXXX() are the methods which are used to get the data from ResultSet by columnwise. Source:
Question: Is the JDBC-ODBC bridge multithreaded ?

Answer: True

Explanation: The JDBC-ODBC Bridge uses synchronized methods to serialize all of the calls that it makes to ODBC. Multi-threaded Java programs may use the Bridge, but they won't get the advantages of multi-threading Source:
Question: What is JDO?

Answer: JDO provides for the transparent persistence of data in a data store agnostic manner, supporting object, hierarchical, as well as relational stores. Source:
Question: How do you determine the sensitivity of the ResultSet object?

Answer: 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. Source:
Question: Explain about Join?

Answer: 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. Source:
Question: How to update a resultset programmatically?

Answer: a. create a scrollable and updatable ResultSet object.
Statement stmt = con.createStatement
ResultSet uprs = stmt.executeQuery("SELECT COLUMN_1,

b. move the cursor to the specific position and use related method to update data and then, call updateRow() method.
uprs.updateFloat("COLUMN_2", 25.55);//update last row's data
uprs.updateRow();//don't miss this me Source:
Question: Which type of JDBC driver is the fastest one?

Answer: JDBC Net pure Java driver(Type IV) is the fastest driver because it converts the jdbc calls into vendor specific protocol calls and it directly interacts with the database. Source:
Question: Which of the following allows phantom read in JDBC, connection class?

Question: How can I tell if my JDBC driver normalizes java.sql.Date and java.sql.Time objects?

Answer: To actually determine the values, the objects must be converted to a java.util.Date and examined. See What does normalization mean for java.sql.Date and java.sql.Time? for the definition of normalization. Notice that even a debugger will not show whether these objects have been normalized, since the getXXX methods in java.sql.Date for time elements and in java.sql.Time for date elements throw an exception.
So, while a java.sql.Date may show 2001-07-26, it's normalized only if the java.uti Source:
Question: What Class.forName( ) method will do?

Answer: Class.forName() will load the class dynamically and it will return the object of type class.
Question: What are the common tasks of JDBC?

Answer: import java.sql.*;
class Type1
public static void main(String[] args)throws Exception
Connection c=null;
Driver d=new Driver("sun.jdbc.odbc.JdbcOdbc");
//or Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Statement s=c.createStatement();
s.executeUpdate("insert into dept(deptno,loc)values(60,'hyd')");
catch(Exception e)
{ Source:
Question: What is the difference between client and server database cursors?

Answer: The client side is the current row of the cursor which called a Result (ODBC) or ResultSet (JDBC). The cursor is a server-side entity only and remains on the server side. Source:
Question: What is the advantage of using a PreparedStatement?

Answer: For SQL statements that are executed repeatedly, using a PreparedStatement object would almost always be faster than using a Statement object. This is because creating a PreparedStatement object by explicitly giving the SQL statement causes the statement to be precompiled within the database immediately. Thus, when the PreparedStatement is later executed, the DBMS does not have to recompile the SQL statement and prepared an execution plan - it simply runs the statement.
Typically, PreparedSta Source:

1 2 3 4 5 6 7 8 9 10 11 Next

India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.296875 Seconds