121-130 Flashcards

1
Q

What is a JDBC driver?

A

A JDBC driver is a software component that enables a java application to interact with the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the role of a JDBC driver manager class?

A

The DriverManager class manages registered drivers. It provides a factory method that returns the instance of a connection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the steps to connect to a database in java?

A
  1. Registering the driver class
  2. Creating a connection
  3. Creating statement
  4. Executing Queries
  5. Closing connection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a JDBC Connection interface?

A

The connection interface maintains a session with the database. It can be used for transaction management

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the purpose of JDBC Result Set interface?

A

The ResultSet object represents a row of a table. It can be used to change the cursor pointer and get the information from the database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is JDBC ResultSetMetaData interface?

A

The ResultSetMetaData interface returns the information of a table such as total number of columns, column name, column type, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is JDBC DatabaseMetaData interface?

A

The DatabaseMetaData interface returns the information of a database such as username, driver name, driver version, number of tables, number of views, etc

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What do you mean by batch processing in JDBC?

A

Batch processing helps you to group related SQL statements into a batch and execute them instead of executing a single query

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the difference between execute, executeQuery and executeUpdate?

A

execute(String query) - is used to execute any SQL query and it returns TRUE if the result is a ResultSet. The output is FALSE when there is no ResultSet object such as running Insert or Update queries.

executeQuery(String query) - is used to execute Select queries and returns the ResultSet. ResultSet is never returned null even if there are no records matching the query.

executeUpdate(String query) - is used to execute Insert/Update/Delete (DML) statements or DDL statements that returns nothing. The output is int and equals to the row count for DML statements or 0 for DDL statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly