In this step we receives the result of execute statement. ResultSet res = st.executeQuery( "SELECT * FROM employee" )
Here is the code that actually execute the statements against database: In this example we will select all the rows from employee table. You can run any type of query against database to perform database operations. In the previous step we established the connection with the database, now its time to execute query against database. Following code we have used to make the connection with the database:Ĭon = DriverManager.getConnection(url+db, user, pass) In the Establishing Connection step we will logon to the database with user name and password. Now its time to make the connection with the database server.
In the above step we have loaded the database driver to be used. Here is the code for loading the JDBC driver:
The JDBC drivers automatically register themselves with the JDBC system when loaded. It is necessary to load the JDBC drivers before attempting to connect to the database. Loading Database driver is very first step towards making JDBC connectivity with the database. Here are the JDBC Steps to be followed while writing JDBC program: In this application we have connected to the MySQL database and retrieved the employee names from the database.
This section gives you brief description of JDBC Steps for making connection with the database, executing the query and showing the data to the user. import java.applet.* import java.awt.* public class textfld extends Applet Applets are used to make the web site more dynamic and entertaining. Applet can't access system resources on the local computer. Applet is designed to run remotely on the client browser, so there are some restrictions on it. Java applets runs on the java enables web browsers such as mozila and internet explorer. (5Marks) Applet is java program that can be embedded into HTML pages. Read your name in one text box and when button is pressed then your name is transferred into text box two. Thread.start() Question 6: a) What is an Applet? Create an Applet program having two text boxes and one button. Multiple inheritance is not directly supported by Java but through Interfaces one can.C->A(Parent)C->B(Parent) For example, if class C inherits from both class A and class B, class C will acquire all the members declared in class A as well as all the members declared in class B.
In multiple inheritance, a class inherits from several super classes. For example, if classes B, C, and D inherit from class A, classes B, C, and D will acquire all the members declared in class A.ī->A(Parent)C->A(Parent)D->A(Parent) In hierarchical inheritance, many sub classes inherit from a single super class.
For example, if class C inherits from class B, and class B inherits from class A, class C will acquire all the members declared in class B as well as all the members declared in class A. In multilevel inheritance, a class inherits from a derived class (or subclass). For example, if class B inherits from class A, class B will acquire all the members declared in class A. In single inheritance, a class inherits implementation from only one super class.