Documente Academic
Documente Profesional
Documente Cultură
Objectives
Answer:
The three methods of the PreparedStatement Interface are:
1. ResultSet executeQuery()
2. int executeUpdate()
3. Boolean execute()
Problem Statement:
The management of the City Library has decided to
computerize the book inventory. You have been asked to
create the Publisher Information application that has an
interactive user interface. The application should allow the user
to add the details of the new publishers to the publishers table.
Solution:
To solve the problem, you need to perform the following tasks:
1. Code the application.
2. Compile and execute the application.
A transaction:
Is a set of one or more SQL statements that are executed as a
single unit.
Is complete only when all the SQL statements in a transaction
execute successfully.
Maintains consistency of data in a database.
Answer:
You can commit a transaction explicitly by setting auto-commit
mode to false.
A batch:
Is a group of update statements that are sent to a database to
be executed as a single unit.
Reduces network calls between the application and the
database.
Is a more efficient way as compared to the processing of a
single SQL statement.
Answer:
The metadata interfaces used to retrieve information about the
database and result set are:
1. DatabaseMetaData interface
2. ResultSetMetaData interface
Problem Statement:
The Manager of New Publishers publishing company,
sometimes require the information about the tables of the
database used by the company. He is not familiar with the SQL
statements, therefore, he has asked you to create an
application to determine the total number of columns and the
data types of the columns of a given table. The table name has
to be specified at the run time.
Solution:
To solve the Preceding problem, perform the following tasks:
1. Code the application.
2. Pass the command line argument.
3. Compile and execute the application.