JDBC

JDBC Projects

JDBC Project 1

JDBC Interview Questions And Answers


Totel:25 Click: 1 2 3 4 5
JDBC Interview Questions And Answers

Page 1

The first thing is to be sure that this does not occur when running non-JDBC apps.If so, there is a faulty JDK/JRE installation.

If it happens only when using JDBC, then it,s time to check the documentation that came with the driver or the driver/DBMS support. 

JDBC driver types 1 through 3 have some native code aspect and typically require some sort of client install.

Along with the install, various environment variables and path or classpath settings must be in place.

Because the requirements and installation procedures vary with the provider, there is no reasonable way to provide details here. A type 4 driver, on the other hand, is pure Java and should never exhibit this problem. 

The trade off is that a type 4 driver is usually slower.

Use DatabaseMetaData.getMaxConnections() and compare to the number of connections currently open.

Note that a return value of zero can mean unlimited or, unfortunately, unknown. 

Of course, driverManager.getConnection() will throw an exception if a Connection can not be obtained.

You will get a scrollable ResultSet object if you specify one of these ResultSet constants .The difference between the two has to do with whether a result set reflects changes that are made to it while it is open and whether certain methods can be called to detect these changes. 

Generally speaking, a result set that is TYPE_SCROLL_INSENSITIVE does not reflect changes made while it is still open and one that is TYPE_SCROLL_SENSITIVE does. All three types of result sets will make changes visible if they are closed and then reopened:

Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

ResultSet srs =stmt.executeQuery("SELECT COF_NAME, PRICE FROM COFFEES");

srs.afterLast();

while (srs.previous()){

String name = srs.getString("COF_NAME");

float price = srs.getFloat("PRICE");

System.out.println(name + " " + price);

}

There are three types of ResultSet objects:

i) TYPE_FORWARD_ONLY: Navigate in forward direction only, which is default.

15

ii) TYPE_SCROLL_INSENSITIVE: Navigate in Forward as well as Backward directions (Scrollable). But the ResultSet is insensitive to changes made to the underlying database while it is open i.e., the changes in data base are not reflected in ResultSet.

iii) TYPE_SCROLL_SENSITIVE: Navigate in Forward as well as Backward directions (Scrollable). Also the ResultSet is sensitive to changes made to the underlying database while it is open i.e., the changes in data source are reflected in ResultSet.

A Connection Object has a method called setAutocommit.For handling our own transaction we can set the parameter to false and begin your transaction .

Finally commit the transaction by calling the commit method.

A class as loaded by the classloader.

Invoke Class.forName("Fully qualified driver class name"), which is used to explicitly Load & Register the Driver class.

Returns the Class object associated with the class or interface with the given string name.


Goto Page:

1 2 3 4 5
JDBC Objective Questions And Answers

JDBC Objective Questions And Answers

JDBC Interview Questions And Answers

JDBC Subjective Questions And Answers


R4R,JDBC Objective fresher and experienced, JDBC Subjective fresher and experienced ,JDBC Interview Questions And Answers,JDBC fresher and experienced,JDBC Interview fresher and experienced ,JDBC Questions fresher and experienced,JDBC Answers fresher and experienced