In connection pooling, the pool size is defined by the _________ and _________ parameters.
- initialConnections, maxConnections
- initialSize, maxSize
- minConnections, maxConnections
- minSize, maxSize
In connection pooling, the pool size is defined by the initialSize and maxSize parameters.
The process of retrieving a connection from the pool, using it, and then returning it is known as _________.
- Connection Fetching
- Connection Recycling
- Connection Recycling
- Connection Releasing
The process of retrieving a connection from the pool, using it, and then returning it is known as Connection Fetching.
To ensure efficient use of database connections, pools use a technique called _________.
- Connection Caching
- Connection Optimization
- Connection Pooling
- Connection Recycling
To ensure efficient use of database connections, pools use a technique called Connection Pooling.
When no connections are available in the pool, the request is put into a __________ until a connection becomes available.
- buffer
- hold
- queue
- stack
When no connections are available, the request is put into a queue until a connection becomes available in the pool.
How do you set a parameter in a PreparedStatement?
- Using the set() method.
- Using the setInt() method.
- Using the setParameter() method.
- Using the setParameter(int index, Object value) method.
Parameters in a PreparedStatement are set using specific methods like setInt(), setString(), etc., depending on the data type of the parameter.
What is a CallableStatement used for in JDBC?
- Executing DDL statements.
- Executing batch updates.
- Executing dynamic SQL queries.
- Executing stored procedures.
CallableStatement is used in JDBC for executing stored procedures in the database, providing a way to call database stored procedures from Java code.
How does PreparedStatement help in preventing SQL injection attacks?
- It automatically escapes special characters in the SQL query.
- It encrypts the entire SQL query.
- It relies on client-side validation.
- It uses parameterized queries.
PreparedStatement helps prevent SQL injection attacks by using parameterized queries, ensuring that user input is treated as data and not executable code.
What method is used to execute a stored procedure using a CallableStatement?
- callProcedure()
- execute()
- executeProcedure()
- executeQuery()
The execute() method is used to execute a stored procedure using a CallableStatement.
How can you retrieve the output of a stored procedure using CallableStatement?
- getOutput()
- getOutputParameterValue()
- getProcedureOutput()
- getResultSet()
You can retrieve the output of a stored procedure using getOutputParameterValue() method in CallableStatement, which returns the value of a designated OUT parameter after the stored procedure execution.
What is the impact on performance when using PreparedStatement for repeated database operations?
- Decreased performance due to compilation
- Improved security with parameterized queries
- Increased performance due to query caching
- No impact on performance
Using PreparedStatement can lead to increased performance as the query is precompiled and cached, reducing database load and improving execution speed.