To learn Angular2 from scratch and most useful for beginners Please see the link below:
• What is AngularJS and What is Angular...
This video actually shows what JDBC does and how to develop JDBC application by using these standard steps.
Basic Components of JDBC:-
1. Driver:
It is a translator to convert Java calls into Specific Database calls and Specific Database calls
into Java calls.
2. Connection :
To convert these calls(Java and DB calls) some connection must be required and that is
nothing but Connection. In short, From Java Application to reach Database Connection must
be required.
3. Statement:
Its purpose is to send SQL Query to the DB under to bring the results from DB to Java
Application.
4. ResultSet:
It's nothing but set of Results processed in DB.
From this ResultSet Java Application can get the result of SQL Query.
*Standard Steps To Develop JDBC Application*
1.Load and Register Driver class.
-Syntax: Class.forName(“Driver Class Name”);
2. Establish Connection Between Java Application and Database.
Syntax:
Connection con=DriverManager.getConnection(“jdbc_url”,”user”,”pwd”);
3. Create Statement Object.
Syntax: Statement st=con.createStatement();
4. Send and Execute SQL Query and Stored in Resultset.
-Syntax: ResultSet rs=st.executeQuery(“select * from Employees”);
5. Process Result From ResultSet.
while(rs.next)
{
Syntax: System.out.println(rs.getInt(1)+” ”+rs.getString(2)+” ”+rs.getString(3));
}
Where rs.getInt(1) is the method contains first column of Employee table and its type is integer.
Ex.eno is type Int.
And same for String Type column 2 & 3 it may be ename & eadd.
6. Close the Connection.
Syntax: con.close();
**A Simple Java(JDBC) Program Using these Standard Steps:***
import java.sql.*; // package for SQL classes
public class JdbcDriver {
public static void main(String[] args) throws Exception {
// Step1:
Class.forName(“oracle.jdbc.OracleDriver”);
// Step2:
Connection con=DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:XE”,”root”,”apple”);
//Step 3:
Statement st=con.createStatement();
// Step 4 & 5:
ResultSet rs=st.executeQuery(select * from Employees);
while(rs.next)
{
System.out.println(rs.getInt(1)+” ”+rs.getString(2)+’’ ”+rs.getString(3));
}
// Step 6:
con.close();
} //closing of main method
} // closing of class
Note: In this program ,we are using Type 4 Driver i.e We are loading Type 4 Driver.
Conclusion:
In these steps, Connection, DriverManager, Statement, ResultSet are the classes which are
present in java.sql.*; package.
So by using these Standard Steps We can Develop any JDBC Application.
Смотрите видео Standard Steps to Develop JDBC Application онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code With Rohini 21 Июль 2018, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 591 раз и оно понравилось 24 людям.