which is responsible for getting a connection to the database?
Mohammed
Guys, does anyone know the answer?
get which is responsible for getting a connection to the database? from screen.
Which is responsible for getting a connection to the database?
Which is responsible for getting a connection to the database? :Driver, Connection, Statement, ResultSet
Which is responsible for getting a connection to the database? JDBC
Driver Connection Statement ResultSet
Answer: Driver553 students attemted this question.
Bookmark Add Comment Share With Friends Report
Explanation
No Explanation Available.
Click To Add
Share this question with friends
Facebook Twitter Instagram Linkedin Youtube
Similar Questions
Which of the following describes the correct sequence of the steps involved in making a connection with a database.1. Loading the driver2. Process the results.3. Making the connection with the database4. Executing the SQL statements
Which of the following describes the correct sequence of the steps involved in making a connection with a database.
What is the correct sequence to create a database connection?
"If we change the Database we have to change the native api as it is specific to a database". The above statement resembles ______ driver.
Which method is used to establish the connection with the specified url in a Driver Manager class?
Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server?
Which of the following is not a JDBC connection isolation levels?
Which of the following allows non repeatable read in JDBC Connection?
Which of these obtains a Connection?
To open a connection, DriverManager._____________________() is to be used.
Which of the following encapsulates an SQL statement which is passed to the database to be parsed, compiled, planned and executed?
In Type 2 Driver, JDBC API calls are converted into native _____________ API calls, which are unique to the database
_____________ driver talks with server-side middleware which then talks to the database
In order to transfer data between a database and an application written in the Java programming language, the JDBC API provides which of these methods?
Which models do the JDBC API support for the database access?
Which result set generally does not show changes to the underlying database that are made while it is open. The membership, order, and column values of rows are typically fixed when the result set is created?
Which type of driver converts JDBC calls into the network protocol used by the database management system directly?
Which of the following methods are needed for loading a database driver in JDBC?
Which of the following driver converts the JDBC calls into database-specific calls?
Which class/interface manages a list of database drivers?
Comments
Add Your Review
Your email address will not be published.
Source Code Examples
Which is responsible for getting a connection to the database?
Which is responsible for getting a connection to the database?
JAVA-QUIZ MCQ
Which is responsible for getting a connection to the database?
A. Driver B. Connection C. Statement D. ResultSet
Answer
A. Driver
Explanation:
The Driver interface is responsible for getting a connection to the database, making Option A the answer.
The Connection interface is responsible for communication with the database but not making the initial connection.
The Statement interface knows how to run the SQL query, and the ResultSet interface knows what was returned by a SELECT query
Free Spring Boot Tutorial - 5 Hours Full Course
Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course
java-quiz mcq
Comments
Best Video on YouTube (Most Liked)
Free Spring Boot Projects [ Download]
Spring Boot E-Commerce Project - Shopizer
Spring Boot Angular Project - Reddit Clone Application
Spring Boot ReactJS CRUD Project - Employee Management App
Spring Boot Microservices, Spring Cloud and React Project - BookStoreApp
Spring Boot Angular Project - BookStore App
Spring Boot Angular Petclinic Project
Microservices with Spring Cloud Project
Spring Boot, Spring Cloud Microservice Project - Spring Petclinic App
Spring Boot Microservice Project - Shopping Cart App
Spring Boot Project - User Registration Module
Spring Boot MVC Web Application - Todo App
Spring Boot WebSocket Project - Chat Application
Spring Boot, Spring Security, JWT, React, and Ant Design - Polling App
Spring Boot, Spring Cloud Microservice Project - PiggyMetrics
Spring Petclinic
Spring Boot MVC Project - Blogs Aggregator
Spring Boot Thymeleaf Project - Employee Management System
Spring Boot + Angular Project - Employee Management System
Spring Initializr
ReactJS Spring Boot CRUD Full Stack Application
Spring Boot Project - Sagan
JavaScript Projects
JavaScript Tic Tac Toe Game
JavaScript Project - Modal Box
JavaScript Calculator Project
JavaScript Project - Password Generator
JavaScript Project - Weather App
JavaScript Project - Todo App
JavaScript Project - Notes App
JavaScript Project - Movie App
JavaScript Project - Drawing App
JavaScript Project - Countdown Timer
Submit Source Code Example
Submit Source Code Example
स्रोत : www.sourcecodeexamples.net
JDBC Quiz
Take this JDBC Quiz to test your self JDBC knowledge.
JDBC Quiz - Multiple Choice Questions
author: Ramesh Fadatare
java quiz jdbc
Take this JDBC Quiz to test your self JDBC knowledge.
JDBC stands for Java Database Connectivity, which is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
Learn complete JDBC at https://www.javaguides.net/p/jdbc-tutorial.html.
1. What must be the first characters of a database URL?
A. db, B. db: C. jdbc, D. jdbc:
Answer
D. jdbc:
Explanation: All JDBC URLs begin with the protocol jdbc followed by a colon as a delimiter. Option D is the only one that does both of these, making it the answer.2. Which of these obtains a Connection?
A. Connection.getConnection(url)
B. Driver.getConnection(url)
C. DriverManager.getConnection(url)
D. new Connection(url)
Answer
C. DriverManager.getConnection(url)
Explanation: is an interface. Since interfaces do not have constructors, Option D is incorrect. The Connection class doesn’t have a static method to get a Connection either, making Option A incorrect. The class is also an interface without static methods, making Option B incorrect. Option C is the answer because is the class used in JDBC to get a Connection.3. Which is responsible for getting a connection to the database?
A. Driver B. Connection C. Statement D. ResultSet
Answer
A. Driver
Explanation: The interface is responsible for getting a connection to the database, making Option A the answer. The interface is responsible for communication with the database but not making the initial connection. The interface knows how to run the SQL query, and the ResultSet interface knows what was returned by a SELECT query4. What is the output when run with a JDBC 4.0 driver if the "demo" database exists and contains an empty "users" table?
String url = "jdbc:derby:demo";
try (Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select count(*) from users")) {
System.out.println(rs.getInt(1));
} A. 0 B. 1
C. The code does not compile.
D. The code compiles but throws an exception at runtime.
Answer
D. The code compiles but throws an exception at runtime.
Explanation: This code is missing a call to rs.next(). As a result, rs.getInt(1) throws an SQLException with the message Invalid cursor state – no current row. Therefore, Option D is the answer.5. Which resources have their close() method called when this code runs?
public static void runQuery(Connection conn) throws SQLException {
try (Statement stmt = conn.createStatement()) {
ResultSet rs = stmt.executeQuery("select * from clowns");
rs.next(); } }
A. No close() methods are called.
B. Only Statement
C. Only Statement and Connection
D. Only Statement and ResultSet
Answer
D. Only Statement and ResultSet
Explanation: Since this code opens Statement using a try-with-resources, Statement gets closed automatically at the end of the block. Further, closing a Statement automatically closes a ResultSet created by it, making Option D the answer. Remember that you should close any resources you open in code you write6. How many rows are added to the colors table from running the following?
try (Connection conn = DriverManager.getConnection(url); Statement stmt = conn.createStatement()) {
conn.setAutoCommit(false);
stmt.executeUpdate("insert into colors values ('red')");
stmt.executeUpdate("insert into colors values ('blue')");
conn.commit();
conn.setAutoCommit(true);
stmt.executeUpdate("insert into colors values ('green')");
} A. None B. One C. Two D. Three
Answer
B. One
Explanation: The code turns off automatic committing, so the inserts for red and blue are not immediately made. The statement actually prevents them from being committed. Then automatic commit is turned back on and one insert is made, making Option B the answer.7. What is the correct order to close database resources?
A. Connection then Statement then ResultSet
B. ResultSet then Statement then Connection
C. Statement then Connection then ResultSet
D. Statement then ResultSet then Connection
Answer
B. ResultSet then Statement then Connection
Explanation: When manually closing database resources, they should be closed in the reverse order from which they were opened. This means that the ResultSet object is closed before the Statement object and the Statement object is closed before the Connection object. This makes Option B the answer.8. Which of the following is not a valid type of ResultSet?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
C - ResultSet.TYPE_SCROLL_SENSITIVE
D - ResultSet.TYPE_BACKWARD_ONLY
Answer
D
Explanation: ResultSet.TYPE_BACKWARD_ONLY is not a valid type of ResultSet.
9. Which JDBC driver type is the JDBC-ODBC type?
Type 1 Type 2 Type 3 Type 4
Guys, does anyone know the answer?