-
Which isolation level prevents dirty read in JDBC, connection class.
A) TRANSACTION_READ_UNCOMMITTEDB) TRANSACTION_READ_ COMMITTEDC) TRANSACTION_SERIALIZABLED) TRANSACTION_REPEATABLE_READ.Explanation: A Dirty read allows a row changed by one transaction to be read by another transaction before any change in the row has been committed.
-
-
-
-
-
-
What is JDBC?
JDBC is a layer of abstraction that allows users to choose between databases. It allows you to change to a different database engine and to write to a single API. JDBC allows you to write database applications in Java without having to concern yourself with the underlying details of a particular database.
-
What packages are used by JDBC?
There are 8 packages: java.sql.Driver, Connection,Statement, PreparedStatement, CallableStatement, ResultSet, ResultSetMetaData, DatabaseMetaData.
-
How can you make the connection?
In establishing a connection is to have the appropriate driver connect to the DBMS. The following line of code illustrates the general idea:E.g.String url = "jdbc:odbc:Fred";Connection con = DriverManager.getConnection(url, "Fernanda", "J8");
-
How can you retrieve data from the ResultSet?
First JDBC returns results in a ResultSet object, so we need to declare an instance of the class ResultSet to hold our results. The following code demonstrates declaring the ResultSet object rs.E.g.ResultSet rs = stmt.executeQuery("SELECT COF_NAME, PRICE FROM COFFEES");Second:String s = rs.getString("COF_NAME");The method getString is invoked on the ResultSet object rs , so getString will retrieve...
-
How to call a Stored Procedure from JDBC?
The first step is to create a CallableStatement object. As with Statement an and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure;E.g.CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");ResultSet rs = cs.executeQuery();
-
-
-
-
-
-
-
Which of the following values can be replaced in the place of 1 and 2 belowStatement stmt = con.createStatement(1, 2);
A) ResultSet. TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLYB) ResultSet. TYPE_SCROLL_INSENSITIVE , ResultSet. CONCUR_UPDATABLEC) ResultSet. CONCUR_UPDATABLE,ResultSet. TYPE_SCROLL_SENSITIVED) ResultSet. CONCUR_UPDATABLE,ResultSet. TYPE_FORWARD_ONLY
-
Which of the statements is true regarding loading a driver in JDBC.1. registerDriver(Driver driver).2. Class.forName(java.lang.String driverclass)
A) 1B) 2C) 1, 2D) Neither of the above
-
JDBC Interview Questions
Ans