JAVA DATABASE CONNECTIVITY TO MYSQL
1. What is the importance of java.sql.*; in java jdbc connection ?
Ans: The java.sql.package has to be imported first before we can create a java jdbc connection to the database.
2. What is DriverManager ?
Ans: DriverManager a class of java.sql package that controls a set of JDBC drivers. Each driver has to be registere with this class.
3. What is the purpose of connection.close() method?
Ans: This method is used for disconnecting the connection. It frees all the resources occupied by the database.
4. Name the four components of JDBC.
Ans: JDBC consisits of four components: The JDBC API, JDBC Driver Manager, The JDBC Test Suite and JDBC-ODBC Bridge.
5. What are the steps involved in establishing a connection?
Ans:To establishing a connection we need to follow two steps: a) loading the driver and b) making a connection.
6. What is ResultSet ?
Ans:A result set (represented by a ResultSet object) refers to a logical set of records that are fetched from the database by executing a query and made available to the applicationprogram.
7. What type of parameter that used in executeQuery( ) method?
Ans: The executeQuery( ) method has a single String parameter. This parameter must be valid SQL command.
8. What is Connection? What is its role?
Ans: A Connection (represented through Connection object) is the session between the application program and the database. To do anything with database, one must have a connection object.
9. What all JDBC classes/objects are used in a database connectivity application?
Ans: a) DriverManager Class b) Connection Object c)Statement Object d) ResultSet Object
10. What is JDBC? What is its basic functionality?
Ans: The JDBC(Java Database Connectivity ) API defines interfaces and classes for writing database applications in Java by making database connections. Using JDBC we can send SQL, PL/SQL statements to almost any relational database. JDBC is a Java API for executing SQL statements and supports basic SQL functionality. It provides RDBMS access by allowing us to embed SQL inside Java code. Because Java can run on a thinclient, applets embedded in Web pages can contain downloadable JDBC code to enable remote database access.
11. What is the JDBC-ODBC Bridge?
Ans: The JDBC-ODBC Bridge is a JDBC driver which implements JDBC operations by translating them into ODBC operations. To ODBC it appears as a normal application program. The Bridge implements JDBC for any database for which as ODBC driver is available. The Bridge is implemented as the sun.jdbc.odbc Java package and contains a native library used to access ODBC.
12. Explain the purpose of DriverManager.
Ans:The DriverManager looks after the managing the drivers for a JDBC application. When it is instantiated it makes an attempt to load the driver classes. When the method getConnection( ) is invoked, the driver manager attempts to locate the suitable driver. The DriverManager obtains the information about the drivers such as registering, locating, finding the drivers loaded, setting the time to wait when it tries to get the connection to a database.
Please refer to attached file for CBSE Class 12 Informatics Practices Java Database Connectivity To MySQL Assignment
Click for more Informatics Practices Study Material ›