CoolInterview.com - 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
COOLINTERVIEW.COM J2EE INTERVIEW QUESTIONS JDBC INTERVIEW QUESTIONS 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: CoolInterview.com
Question: Which of the following allows non repeatable read in JDBC, connection class?

Answer: TRANSACTION_READ_UNCOMMITTED Source: CoolInterview.com
Question: what is different between tier and 3 tier?

Answer: Question is not correct
if question is 1-tier and 3-tier
Answer
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
Source: CoolInterview.com
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: CoolInterview.com
Question: What Class.forName will do while loading drivers?

Answer: Dynamic loading of Java classes at runtime provides tremendous flexibility in the development of enterprise systems. It provides for the basis of "application servers", and allows even simpler, lighter-weight systems to accomplish some of the same ends. Within Java, dynamic loading is typically achieved by calling the forName method on the class java.lang.Class; however, when Class.forName is naively called from within an Extension, strange errors can occur. This paper describes why those errors Source: CoolInterview.com
Question: The full form of ODBC is ___________

Answer: (ODBC)---->OPEN DATABASE CONNECTIVITY Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: What Class.forName( ) method will do?


Answer: Class.forName() will load the class dynamically and it will return the object of type class.
Source: CoolInterview.com
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);
Source: CoolInterview.com
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: CoolInterview.com
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: CoolInterview.com
Question: Where to use which driver in JAVA?


Answer: The following is some information I could find on web regarding JDBC drivers:

- The following website (not sure about the information) maintains a list of drivers and their use

http://www.sqlsummit.com/JDBCVend.htm

- A driver can be looked at Sun's website at the following location:

http://industry.java.sun.com/products/jdbc/drivers

- A JDBC driver is a class that implements the JDBC Driver interface and understands how to convert program (and typically SQL Source: CoolInterview.com
Question: what is savepoint?

Answer: Save point is a feature using which we can save status of the transaction to a perticular extent.so that if anytime we have lost a transaction we can get it back using save point. Source: CoolInterview.com
Question: How can you retrieve data from the ResultSet?

Answer: Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(SELECT COF_NAME, PRICE FROM COFFEES");
while (rs .next() )
{
//Iam assuming there are 3 columns in the table.
System.out.println ( rs.getString(1));
System.out.println(rs.getString(2));
System.out.println(rs.getString(3));
}

//don't forget to close the resultset, statement & connection

rs.close(); //First
stmt.close(); //Second
con.close(); //Last
System.o Source: CoolInterview.com
Question: What are the different types of Statements?

Answer: 1.Statement (use createStatement method)

2. Prepared Statement (Use prepareStatement method)

3. Callable Statement (Use prepareCall). Source: CoolInterview.com
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: CoolInterview.com
Question: Which of the following allows phantom read in JDBC, connection class?


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

Answer: a. create a scrollable and updatable ResultSet object.
Statement stmt = con.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet uprs = stmt.executeQuery("SELECT COLUMN_1,
COLUMN_2 FROM TABLE_NAME");

b. move the cursor to the specific position and use related method to update data and then, call updateRow() method.
uprs.last();
uprs.updateFloat("COLUMN_2", 25.55);//update last row's data
uprs.updateRow();//don't miss this me Source: CoolInterview.com

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.074219 Seconds