Font size
WorksheetsU3.1. Connections (JDBC)
Total questions: 18
Worksheet time: 13mins
What are connectors?
A type of database management software.
Libraries that allow applications to communicate with a database management system.
Software components that directly store data.
Tools for creating databases.
Which is not a CRUD operation?
Update
Create
Modify
Read
Delete
What is JDBC primarily used for?
Creating new databases
Connecting Java applications to various database management systems
Formatting SQL queries
Encrypting database connections
What does the java.sql.Connection class represent?
A tool to manage database drivers
A connection to a database
A class to execute SQL statements
A method to handle SQL errors
In JDBC, what does the URL format jdbc:%subprotocol%:%db_name% represent?
It represents a file path for SQLite databases only.
It specifies the location and protocol for a database connection.
It defines the user and password for connection.
It provides the SQL syntax for a database connection.
Which JDBC class is responsible for managing drivers?
DriverClass
DriverManager
DriverConnector
DriverControler
What method is used for connecting to a database?
createConnection
connectToDB
openConnection
getConnection
What is the correct way to close a JDBC connection in a try-with-resources block?
con.close();
try(Connection con = DriverManager.getConnection(...)){ }
DriverManager.close(con);
closeConnection(con);
What are metadata in the context of databases?
Safety data
Configuration data
User data
Data about data
What is the primary use of DatabaseMetaData in JDBC?
To define SQL statements
To retrieve information about the database structure
To share data to an external database
To store data
In JDBC, which method retrieves the metadata of a database?
getMetaData
getDatabaseMetaData
getDriverManager
getConnection
Which of the following statements about getTables method in DatabaseMetaData is true?
It returns metadata about columns in a table
It returns a ResultSet with information on database tables
It returns a ResultSet with information on columns in a table
It is only used with SQLite databases
What type of information can you obtain with the method getColumns?
Information about the indexes of a table
Information about the rows of a table
Information about the columns of a table
Information about the relationships between tables
What type of exceptions can be handled in database operations?
SQLException
ClassNotFoundException
IOException
NullPointerException
What does the following code print if the database has a column named AGE that is nullable?
ResultSet columnas = dbmd.getColumns(null, null, "Users", null);
while (columnas.next()) {
System.out.println("Nullable: " + columnas.getString("IS_NULLABLE")); }
"Nullable: NO"
"Nullable: NULL"
"Nullable: YES"
An error message
Which of the following components is essential to enable JDBC in a Java project using Maven?
Adding the database driver as a Maven dependency
Importing the java.sql.* package
Installing the database locally
Creating a database-config.xml file
What do you think is the most important concept of the content covered in this unit?
You can only use 1-2 words.
From 1 to 5, how confident do you feel with the topic covered in this unit?
1 - not confident at all
2 - slightly confident
3 - moderately confident
4 - very confident
5 - extremely confident
