What is ResultSet in jdbc ? How to fetch data ? | HINDI | JDBC #13
ฝัง
- เผยแพร่เมื่อ 19 ก.ค. 2019
- In this video, I will explain what is ResultSet in JDBC? How we can fetch data?
What is ResultSet? How to fetch data? | HINDI | JDBC #13
/STEP 1. Import required packages
import java.sql.*;
public class Main{
// JDBC driver name and database URL
static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
static final String DB_URL = "jdbc:mysql://localhost/STUDENTS";
// Database credentials
static final String USER = "username";
static final String PASS = "password";
public static void main(String[] args) {
Connection conn = null;
Statement stmt = null;
try{
//STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
//STEP 3: Open a connection
System.out.println("Connecting to a selected database...");
conn = DriverManager.getConnection(DB_URL, USER, PASS);
System.out.println("Connected database successfully...");
//STEP 4: Execute a query
System.out.println("Creating statement...");
stmt = conn.createStatement();
String sql = "SELECT id, first, last, age FROM Registration";
ResultSet rs = stmt.executeQuery(sql);
//STEP 5: Extract data from result set
while(rs.next()){
//Retrieve by column name
int id = rs.getInt("id");
int age = rs.getInt("age");
String first = rs.getString("first");
String last = rs.getString("last");
//Display values
System.out.print("ID: " + id);
System.out.print(", Age: " + age);
System.out.print(", First: " + first);
System.out.println(", Last: " + last);
}
rs.close();
}catch(SQLException se){
//Handle errors for JDBC
se.printStackTrace();
}catch(Exception e){
//Handle errors for Class.forName
e.printStackTrace();
}finally{
//finally block used to close resources
try{
if(stmt!=null)
conn.close();
}catch(SQLException se){
}// do nothing
try{
if(conn!=null)
conn.close();
}catch(SQLException se){
se.printStackTrace();
}//end finally try
}//end try
System.out.println("Goodbye!");
}//end main
}//end Class
Very clear and concise series for jdbc ! Thanks
By far one of the best channel ever that provides clear understanding in simple language. Sir Thank you so much.
Your teaching style is very beautiful.
Keep doing such amazing work.
Sir needed to laern JDBC and i found your channel amazing so i started your course. Sir, is this course complete? If not then please tell us the topics which are left so i can cover them on my own. I am on a deadline.
Thank you sir for amazing explanation
Just Finished this series..Thankyou Sir!!!
Thank you sir for this series . 🙏 Sir please can you continue this series 🙏🙏🙏
Thanks for the series..,its realy help me
Thank you sir for your tutorial ... Now iam ready for learn more on java frameworks
so knowledgeable series durgesh big fan .
Thanks for the tutorial , Brother !!
Thank you bhai for this tutorial i gained much more knowledge ❤️❤️
Excellent Series
Thank you so much Durgesh Sir for providing such quality content. I really enjoyed and learned a lot from this entire playlist. TYSM
Really helpful
Waooo sir amazing tutorials
bohot sahi bhai
Please continue this playlist
Thank you sirrrrr
Two words: Thank you
Acha padhate ap
Thank you
Thanku
Sir please make video on Row Set
nice 😊
Please ek bar metadata and callablestatement pn video bano
Great playlist. Is there a video on how to do the mapping between ImageName in DB and the image stored in a file? And then finally display on webpage?
Sir please saare types ke statements ko acche se sikhayiye alag se video banake aur aage rowset bhi
please complete this tutorial as soon as possible
series is amazing but incomplete
Sir why you stopped making videos on jdbc ?? Please continue.
Hello Sir. I am from Mumbai can you just tell me this one is complete advance java tutorial...
Hello Bhai
Bhot sahi video series👏👏...!
Next video kab dalonge RollSet ka?
Next video upload kro sahbbbb
Rollset nhi RowSet
please complete this playlist.
sir what is resultset metadata
sir please row set ka video laye
Itni he series hai kya ??.... Whan will be the nxt video come??
playlist toh puri kardete yrr
bhai jdbc me import mcq question do meri exam hai 1 din baad
sir next video kab ayegi?
bhai next video kb aayegi iss series mein?
Sir please complete the remainning jdbc
sir yahi bs last video hai jdbc ki ya fir iss hi series ki kahi or bhi upload hai
bhai etne hi videos h is series me?
whats after JDBC????
Where is the rowset video you promised towards the end of this video. could not find it in the comments.
yes bro , I also tried to find out but couldn't find out.
I have one question. Can we do Interface object. I read we are create only class object not interface.
We cannot create object for interface in java.
You can create object of the implementing class of the interface
you read right . we can create the objec of the classes only , this is because the interfaces follow abstraction and abstraction doesn't allow to create object.
Next Video sir?
RowSet ka set ka vdo or Link
Where is RowSet video link?
Rest of the videos are hoid but this video has nothing but use RowSet instead of ResultSet. Dont lower your level by such hallow videos sor. Rest are good.
after ResultSet you not create a video on rowset
ab pura video spring me ja kar dekho
Brother isake age ke videos kaha milenge
sal bhr ho gyea next video kbb aae gi
Bhai bs ab sms ka koi solution bta do. 😅
hn bhai banayenge uski bhi video..
@@LearnCodeWithDurgesh as soon as possible
I'm waiting for it.
@@LearnCodeWithDurgesh jdbc ko complete krdo please 🙏🏻
how to fetch particular data ??
Is this palylist incomplete??
yes but the core concept is cover
bhai sab to theek hai leikn coding karte wqt etna jald baji kyu karte hai wahi samjne wala part hota usi ko app uda dete hai...
ek bhi method sahi se describes nahi karte aur etna object bana lete hai ki use me sab confuse ho jata hai.
is problem ko overcome kare less coding maximum output.
Object nhi banaoge to coding kaise hogi bro...Code ko samjho samjh ayega