Font size
WorksheetsJDBC_Objective_Exam_2
Total questions: 15
Worksheet time: 14mins
Which class or interface contains the transaction control methods setAutoCommit(),commit(), and rollback()?
Statement
Connection
ResultSet
none of the above
Which character is used to represent an input parameter in CallableStatement?
%-Percentage symbol
#-hash
?-Question Mark
*-star
When the message “No Suitable Driver” occurs ?
When the type 4 driver is used?
When the driver is not registered by Class.forName() method
When the JDBC database URL passed is not constructed properly
When the user name, password and the database does not match
What does setAutoCommit(false) do?
commits transaction after each query
explicitly commits transaction
does not commit transaction automatically after each query
never commits transaction
For inserting data into database Which Interface is used in JDBC Program?
Statement
PreparedStatement
CallableStatement
ParameterisedStatement
Write the code for loading a Type-4 driver in JDBC program.
(a)
What are different Exceptions thrown in JDBC?
(a)
Write the statement for establishing data base Connection in JDBC.
(a)
Which jar file should be set in the classpath for loading jdbc driver?
odbc.jar
ojdbc14.jar
ojdbc23.jar
jdbco20.jar
Write a JDBC Program to retrieve the Student data from Student Table?
What are the correct sequence of steps to connect any database using JDBC ?
import packages,load or register the driver class,establish connection,create the statement,execute queries,close the connection
establish connection,import packages,load or register the driver class,execute queries,create the statement,close the connection
create the statement,import the packages,establish connection,import packages,load or register the driver class,execute queries,close the connection
establish connection,create the statement,import the packages,import packages,load or register the driver class,execute queries,close the connection
What are the methods in Statement Interface?
public ResultSet executeQuery(String sql): is used to execute SELECT query. It returns the object of ResultSet.
public int executeUpdate(String sql): is used to execute specified query, it may be create, drop, insert, update, delete etc.
public boolean execute(String sql): is used to execute queries that may return multiple results.
public int[] executeBatch(): is used to execute batch of commands.
This method is for retrieving a String Value(SQL type VARCHAR) and assigning to String Object.
getVarchar()
getString()
getObject()
getInt()
What are the Interfaces available in JDBC?
Connection interface
PreparedStatement interface
ResultSet interface
RowSet interface
What is return type of executeUpdate() method ?
int
String
Date
ResultSet
