Read and download free pdf of CBSE Class 12 Informatics Practices Database Connectivity To MySQL Worksheet. Students and teachers of Class 12 Informatics Practices can get free printable Worksheets for Class 12 Informatics Practices Database Connectivity To MySQL in PDF format prepared as per the latest syllabus and examination pattern in your schools. Class 12 students should practice questions and answers given here for Informatics Practices in Class 12 which will help them to improve your knowledge of all important chapters and its topics. Students should also download free pdf of Class 12 Informatics Practices Worksheets prepared by teachers as per the latest Informatics Practices books and syllabus issued this academic year and solve important problems with solutions on daily basis to get more score in school exams and tests
Worksheet for Class 12 Informatics Practices Database Connectivity To MySQL
Class 12 Informatics Practices students should refer to the following printable worksheet in Pdf for Database Connectivity To MySQL in Class 12. This test paper with questions and answers for Class 12 will be very useful for exams and help you to score good marks
Class 12 Informatics Practices Worksheet for Database Connectivity To MySQL
CBSE Class 12 Informatics Practices Database Connectivity To Mysql. Students can download these worksheets and practice them. This will help them to get better marks in examinations. Also refer to other worksheets for the same chapter and other subjects too. Use them for better understanding of the subjects.
CHAPTER 8: DATABASE CONNECTIVITY TO MYSQL
MYSQL provides connectivity for client applications developed in the Java programming language
via JDBC driver, which is called “MYSQL Connector/J”.
There are four main classes in the JDBC API for database connectivity:
(i) Driver Manager Class: It locates and logs on to the database and returns a connection object.
(ii) Connection Class: It manages the communication between Java & MySQL.
(iii) Statement Class: It contains SQL string that is submitted to the database. An SQL Select
statement returns a ResultSet object that contains the data retrieved as the result of SQL
statement.
(iv) ResultSet Class: A result set is the logical set of records that are fetched from the database by
executing a query and made available to the application program. It accesses, analyzes and
converts data values returned by the SQL select statement.
Steps for Creating Database Connectivity Application:
(i) Import the package required for database programming:
import java.sql.Connection;
import java.sql.DriverManager; or import java.sql.*
import java.sql.Statement;
import java.sql.ResultSet;
(ii) Register the JDBC driver with Driver Manager:
Class.forName(“java.sql.Driver”); or Class.forName(“com.mysql.jdbc.Driver”);
(iii) Open a connection:
Connection conn = DriverManager.getConnection(“jdbc:mysql://localhost:3306/test”, “root”,
“tiger”);
Test is the name of SQL database, root is user id and tiger is MySQL password.
(iv) Execute a query: Create an object of type Statement using createStatement() method. Then
execute the SQL statement using executeQuery( ) method, in case of SELECT query, or
executeUpdate() method, in case of UPDATE, INSERT or DELETE or Create Table query. It returns an
object of resultSet type.
Statement stmt = conn.createStatement();
String sql= “Select id, name from employee”;
ResultSet rs = stmt.executeQuery(sql);
sql = “delete from employee”;
ResultSet rs = stmt.executeUpdate(sql);
ResultSet Cursor: When a ResultSet object is created, the cursor is placed just before the first row.
To move the cursor to first row use rs.next() or rs.first(). rs.next() forwards the cursor by one row –
since Initially cursor is before the first row, first rs.next() will move the cursor to first row. Any
following rs.next() commands forward the cursor by one row.
(v) Extract data from result set: This step is required if data is fetched from the database i.e., in
case of SELECT query. To retrieve the data ResultSet.get
getLong(), getString(), getFloat(), getDate() etc. All these method takes parameter as Column Name
or Column Index. Column Index is the order of the column.
int id = rs.getInt(“id”); // if more than one column exists in result set with same
Column Name then the first one is returned.
or int id = rs.getInt(1); // If id is first field of table.
String name = rs.getString(“name”);
Retrieving data from result set if it contains multiple rows:
Use rs.next() method. In addition to moving a result-set by one row, it also returns true if cursor is
positioned on a row and false if cursor is positioned after the last row.
int id; String name;
while (rs.next()){ id = rs.getInt(1);
name = rs.getString(2); // display or process here.}
(v) Clean up the environment: Close all database resources using close() method.
rs.close(); stmt.close(); conn.close();
Sample Questions:
1. What is a connection and a result set?
2. What does Driver Manager do?
3. Write a statement to open a connection object namely myconn for a MySQL database namely
school.
4. What are the steps to connect to a database from the Java application?
UNIT- 2: Questions & Answers
Very Short answer types questions
1. Write the expression to print the value of a variable "Sum" of type int in a label.
Ans: jLabel1.setText(“”+Sum);
2. Name any two commonly used method of ListBox.
Ans: getSelectedIndex() and getSelectedValue()
3. Write code to add an element (“IP”) to a list (MyList) at the beginning of the list.
Ans: MyList.add(0,"IP");
4. Write command to display a message dialog to display prompt as “Hi! Everybody”.
Ans: JOptionPane.showMessageDialog(null,"Hi! Everybody");
5. How would you make a combo box editable? Ans: By setting its editable property to true.
6. Name the different list type controls offered by Java Swing.
Ans: (i) jListBox (ii) jComboBox
7. In JDBC coding, what method is used to move to last record of the recordSet with name recSet?
Ans: recSet.last();
8. What is the name of event listener interface for action events?
Ans ActionPerformed
9. Name the inheritance type which is not supported by JAVA.
Ans Multiple inheritance
10. What will be the value of jTextField1 after execution of following code:
jTextField1.setText(“Computer”.subString(3,3));
Ans: put
11. Name the character set supported by Java.
Ans: Unicode.
12. What will be the value of b if initial value if a is 13 (i) b= ++a (ii) b= a++
Ans: (i) 14 (ii) 13
13. Name the 4 essential class libraries that we need to import for setting up the connection with
the database and retrieve data from the database.
Ans: DriverManager, Connection, Statement, ResultSet
14. What is Event? Ans. An Event refers to the occurrence of an activity.
15. What will be displayed in jTextArea after executing the following? jTextArea1.setText(“India \n
is a great \t country”);
Ans: India
is a great country.
16. Name any Swing control which is invisible on the Frame?
Ans: ButtonGroup
17. How one can make a text field un-editable on a frame?
Ans: jTextfield1.setEditable(false);
18. What is Message? Ans. A Message is the information/request sent to the application.
19. Which property of list box is used to add values in the list?
Ans: Model Property
Short Answers Type Questions (2 Marks)
1. What are Access Specifiers? How Access is controlled for members of Super class?
Ans: Access specifier tells a complier about the accessibility of a data member of a class in a java
program.
a) Private: Private members of a class can just be accessed inside the class and are hidden
outside the class.
b) Protected: A class member with protected access specifier can be inherited by a sub class
but is not accessed outside the parent class.
c) Public: A Class member with public access specifier is accessible outside the class.
d) Default: These members are accessible only in the class that are in the same package class
i.e., in their own classes
2. What is a Method (Function)?
Ans: A Method or function is sequence of statement which is written to perform a specific job in
the application.
Please click the link below to download CBSE Class 12 Informatics Practices Database Connectivity To Mysql
CBSE Class 12 Informatics Practices Data Handling using Pandas Worksheet |
CBSE Class 12 Informatics Practices Societal Impacts Worksheet |
CBSE Class 12 Informatics Practices Database Connectivity To MySQL Worksheet
We hope students liked the above worksheet for Database Connectivity To MySQL designed as per the latest syllabus for Class 12 Informatics Practices released by CBSE. Students of Class 12 should download in Pdf format and practice the questions and solutions given in the above worksheet for Class 12 Informatics Practices on a daily basis. All the latest worksheets with answers have been developed for Informatics Practices by referring to the most important and regularly asked topics that the students should learn and practice to get better scores in their class tests and examinations. Studiestoday is the best portal for Class 12 students to get all the latest study material free of cost.
Worksheet for Informatics Practices CBSE Class 12 Database Connectivity To MySQL
Expert teachers of studiestoday have referred to the NCERT book for Class 12 Informatics Practices to develop the Informatics Practices Class 12 worksheet. If you download the practice worksheet for one chapter daily, you will get higher and better marks in Class 12 exams this year as you will have stronger concepts. Daily questions practice of Informatics Practices worksheet and its study material will help students to have a stronger understanding of all concepts and also make them experts on all scoring topics. You can easily download and save all revision worksheet for Class 12 Informatics Practices also from www.studiestoday.com without paying anything in Pdf format. After solving the questions given in the worksheet which have been developed as per the latest course books also refer to the NCERT solutions for Class 12 Informatics Practices designed by our teachers
Database Connectivity To MySQL worksheet Informatics Practices CBSE Class 12
All worksheets given above for Class 12 Informatics Practices have been made as per the latest syllabus and books issued for the current academic year. The students of Class 12 can be rest assured that the answers have been also provided by our teachers for all worksheet of Informatics Practices so that you are able to solve the questions and then compare your answers with the solutions provided by us. We have also provided a lot of MCQ questions for Class 12 Informatics Practices in the worksheet so that you can solve questions relating to all topics given in each chapter. All study material for Class 12 Informatics Practices students have been given on studiestoday.
Database Connectivity To MySQL CBSE Class 12 Informatics Practices Worksheet
Regular worksheet practice helps to gain more practice in solving questions to obtain a more comprehensive understanding of Database Connectivity To MySQL concepts. Worksheets play an important role in developing an understanding of Database Connectivity To MySQL in CBSE Class 12. Students can download and save or print all the worksheets, printable assignments, and practice sheets of the above chapter in Class 12 Informatics Practices in Pdf format from studiestoday. You can print or read them online on your computer or mobile or any other device. After solving these you should also refer to Class 12 Informatics Practices MCQ Test for the same chapter.
Worksheet for CBSE Informatics Practices Class 12 Database Connectivity To MySQL
CBSE Class 12 Informatics Practices best textbooks have been used for writing the problems given in the above worksheet. If you have tests coming up then you should revise all concepts relating to Database Connectivity To MySQL and then take out a print of the above worksheet and attempt all problems. We have also provided a lot of other Worksheets for Class 12 Informatics Practices which you can use to further make yourself better in Informatics Practices
You can download the CBSE Printable worksheets for Class 12 Informatics Practices Database Connectivity To MySQL for latest session from StudiesToday.com
Yes, you can click on the links above and download Printable worksheets in PDFs for Database Connectivity To MySQL Class 12 for Informatics Practices
Yes, the Printable worksheets issued for Class 12 Informatics Practices Database Connectivity To MySQL have been made available here for latest academic session
You can easily access the links above and download the Class 12 Printable worksheets Informatics Practices Database Connectivity To MySQL for each chapter
There is no charge for the Printable worksheets for Class 12 CBSE Informatics Practices Database Connectivity To MySQL you can download everything free
Regular revision of practice worksheets given on studiestoday for Class 12 subject Informatics Practices Database Connectivity To MySQL can help you to score better marks in exams
Yes, studiestoday.com provides all latest NCERT Database Connectivity To MySQL Class 12 Informatics Practices test sheets with answers based on the latest books for the current academic session
Yes, studiestoday provides worksheets in Pdf for Database Connectivity To MySQL Class 12 Informatics Practices in mobile-friendly format and can be accessed on smartphones and tablets.
Yes, worksheets for Database Connectivity To MySQL Class 12 Informatics Practices are available in multiple languages, including English, Hindi
CBSE Class 12 Informatics Practices worksheets help students practice all concepts given in their books, improve problem-solving skills, and prepare effectively for CBSE exams
CBSE Class 12 Informatics Practices Database Connectivity To MySQL worksheets cover all topics as per the latest syllabus for current academic year.
Regular practice with Class 12 Informatics Practices worksheets can help you understand all concepts better, you can identify weak areas, and improve your speed and accuracy.
All worksheets for Class 12 Informatics Practices and for Database Connectivity To MySQL have solved questions with step by step guide for each solution
Practice atleast one worksheet of Database Connectivity To MySQL every day for Class 12 Informatics Practices