-
State true or false :-The new features in the JDBC 2.0 API is the ability to move a result set’s cursor backward as well as forward.
A) TrueB) FalseExplanation: There are also methods that let you move the cursor to a particular row and check the position of the cursor
-
-
-
-
-
-
-
-
-
-
-
-
What are the steps for connecting to the database using JDBC
Answered by Jey on 2005-05-10 06:01:10: Here are the steps. Using DriverManager: 1. Load the driver class using class.forName(driverclass) and class.forName() loads the driver class and passes the control to DriverManager class 2.DriverManager.getConnection() creates the connection to the databse Using DataSource. DataSource is used instead of DriverManager in Distributed...
-
-
What Class.forName will do while loading drivers?
It is used to create an instance of a driver and register it with the DriverManager. When you have loaded a driver, it is available for making a connection with a DBMS.
-
What packages are used by JDBC?
There are 8 packages: java.sql.Driver, Connection,Statement, PreparedStatement, CallableStatement, ResultSet, ResultSetMetaData, DatabaseMetaData.
-
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();
-
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.
-
JDBC Interview Questions
Ans