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

ความคิดเห็น • 67

  • @user-sz8bi1fc3r
    @user-sz8bi1fc3r หลายเดือนก่อน

    Very clear and concise series for jdbc ! Thanks

  • @amritapatjoshi3199
    @amritapatjoshi3199 2 ปีที่แล้ว +3

    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.

  • @akashjariwala5354
    @akashjariwala5354 3 ปีที่แล้ว +13

    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

  • @anjaligaikwad692
    @anjaligaikwad692 2 ปีที่แล้ว +2

    Just Finished this series..Thankyou Sir!!!

  • @BEYOU2111
    @BEYOU2111 2 ปีที่แล้ว +1

    Thank you sir for this series . 🙏 Sir please can you continue this series 🙏🙏🙏

  • @user-kw1id7jo2c
    @user-kw1id7jo2c 11 หลายเดือนก่อน

    Thanks for the series..,its realy help me

  • @08_ankush72
    @08_ankush72 ปีที่แล้ว

    Thank you sir for your tutorial ... Now iam ready for learn more on java frameworks

  • @priyankabiradar3299
    @priyankabiradar3299 ปีที่แล้ว

    so knowledgeable series durgesh big fan .

  • @luvrathore7884
    @luvrathore7884 3 ปีที่แล้ว +1

    Thanks for the tutorial , Brother !!

  • @vishwasverma9990
    @vishwasverma9990 ปีที่แล้ว

    Thank you bhai for this tutorial i gained much more knowledge ❤️❤️

  • @viveksrivastava5478
    @viveksrivastava5478 2 ปีที่แล้ว +2

    Excellent Series

  • @manishsalve5322
    @manishsalve5322 2 ปีที่แล้ว +3

    Thank you so much Durgesh Sir for providing such quality content. I really enjoyed and learned a lot from this entire playlist. TYSM

  • @nehagusain2582
    @nehagusain2582 10 หลายเดือนก่อน +1

    Really helpful

  • @prasantdwivedi9325
    @prasantdwivedi9325 3 ปีที่แล้ว +3

    Waooo sir amazing tutorials

  • @NoName-py4dj
    @NoName-py4dj 4 ปีที่แล้ว +2

    bohot sahi bhai

  • @VikramKumar-dq2is
    @VikramKumar-dq2is 3 ปีที่แล้ว +1

    Please continue this playlist

  • @ce105vaibhavrathod2
    @ce105vaibhavrathod2 ปีที่แล้ว

    Thank you sirrrrr

  • @ashishkumarsingh6618
    @ashishkumarsingh6618 ปีที่แล้ว +1

    Two words: Thank you

  • @mohammedajazquadri7869
    @mohammedajazquadri7869 4 ปีที่แล้ว +2

    Acha padhate ap

  • @butterfly-er6zs
    @butterfly-er6zs ปีที่แล้ว

    Thank you

  • @sonytv_livesharktank
    @sonytv_livesharktank 7 หลายเดือนก่อน

    Thanku

  • @nawazkamboo8750
    @nawazkamboo8750 2 ปีที่แล้ว +3

    Sir please make video on Row Set

  • @ritikchoudhary9601
    @ritikchoudhary9601 2 ปีที่แล้ว

    nice 😊

  • @vigneshpaygude3045
    @vigneshpaygude3045 3 ปีที่แล้ว +3

    Please ek bar metadata and callablestatement pn video bano

  • @DigvijaySingh-zd9hq
    @DigvijaySingh-zd9hq 11 หลายเดือนก่อน

    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?

  • @ashwindev1090
    @ashwindev1090 2 ปีที่แล้ว +1

    Sir please saare types ke statements ko acche se sikhayiye alag se video banake aur aage rowset bhi

  • @amanprakash7415
    @amanprakash7415 2 ปีที่แล้ว +3

    please complete this tutorial as soon as possible

  • @abhijitpawar2480
    @abhijitpawar2480 2 ปีที่แล้ว +4

    series is amazing but incomplete

  • @soumyadeepmallick6282
    @soumyadeepmallick6282 3 ปีที่แล้ว +4

    Sir why you stopped making videos on jdbc ?? Please continue.

  • @MahtabAlam-eu2hb
    @MahtabAlam-eu2hb 3 ปีที่แล้ว +3

    Hello Sir. I am from Mumbai can you just tell me this one is complete advance java tutorial...

  • @shivampali9033
    @shivampali9033 4 ปีที่แล้ว +2

    Hello Bhai
    Bhot sahi video series👏👏...!
    Next video kab dalonge RollSet ka?

  • @codewithbrijesh6172
    @codewithbrijesh6172 ปีที่แล้ว +1

    please complete this playlist.

  • @massiahplays2261
    @massiahplays2261 2 ปีที่แล้ว +4

    sir what is resultset metadata

  • @gamerg9271
    @gamerg9271 3 ปีที่แล้ว

    sir please row set ka video laye

  • @ajinkyakamble173
    @ajinkyakamble173 3 ปีที่แล้ว

    Itni he series hai kya ??.... Whan will be the nxt video come??

  • @Everydayshorts913
    @Everydayshorts913 ปีที่แล้ว

    playlist toh puri kardete yrr

  • @massiahplays2261
    @massiahplays2261 2 ปีที่แล้ว +1

    bhai jdbc me import mcq question do meri exam hai 1 din baad

  • @abhishekbarman8610
    @abhishekbarman8610 3 ปีที่แล้ว +2

    sir next video kab ayegi?

  • @anmolbansal4184
    @anmolbansal4184 3 ปีที่แล้ว

    bhai next video kb aayegi iss series mein?

  • @sufiyansalman2780
    @sufiyansalman2780 ปีที่แล้ว

    Sir please complete the remainning jdbc

  • @BitFire007
    @BitFire007 ปีที่แล้ว

    sir yahi bs last video hai jdbc ki ya fir iss hi series ki kahi or bhi upload hai

  • @KishlayRajSanu
    @KishlayRajSanu ปีที่แล้ว

    bhai etne hi videos h is series me?

  • @ritikbhardwaj4061
    @ritikbhardwaj4061 4 ปีที่แล้ว +1

    whats after JDBC????

  • @jabroomunda
    @jabroomunda ปีที่แล้ว +1

    Where is the rowset video you promised towards the end of this video. could not find it in the comments.

    • @dhirajsardar1430
      @dhirajsardar1430 7 หลายเดือนก่อน

      yes bro , I also tried to find out but couldn't find out.

  • @RajNa27_11
    @RajNa27_11 2 ปีที่แล้ว +2

    I have one question. Can we do Interface object. I read we are create only class object not interface.

    • @lodhiyavishnu4714
      @lodhiyavishnu4714 2 ปีที่แล้ว +1

      We cannot create object for interface in java.

    • @AshutabSingh
      @AshutabSingh 2 ปีที่แล้ว +1

      You can create object of the implementing class of the interface

    • @dhirajsardar1430
      @dhirajsardar1430 7 หลายเดือนก่อน

      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.

  • @komaldumbre583
    @komaldumbre583 3 ปีที่แล้ว

    Next Video sir?

  • @saurabhdighe7409
    @saurabhdighe7409 3 ปีที่แล้ว

    RowSet ka set ka vdo or Link

  • @shankar7435
    @shankar7435 หลายเดือนก่อน

    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.

  • @rushikeshpotdar118
    @rushikeshpotdar118 หลายเดือนก่อน

    after ResultSet you not create a video on rowset

  • @manjitonline
    @manjitonline ปีที่แล้ว

    ab pura video spring me ja kar dekho

  • @devidaspophalnare
    @devidaspophalnare 3 ปีที่แล้ว

    Brother isake age ke videos kaha milenge

  • @riteshdangi7460
    @riteshdangi7460 4 ปีที่แล้ว

    sal bhr ho gyea next video kbb aae gi

  • @mohdaltamash2571
    @mohdaltamash2571 5 ปีที่แล้ว +1

    Bhai bs ab sms ka koi solution bta do. 😅

    • @LearnCodeWithDurgesh
      @LearnCodeWithDurgesh  5 ปีที่แล้ว +2

      hn bhai banayenge uski bhi video..

    • @mohdaltamash2571
      @mohdaltamash2571 5 ปีที่แล้ว

      @@LearnCodeWithDurgesh as soon as possible
      I'm waiting for it.

    • @tusharmusician
      @tusharmusician 2 ปีที่แล้ว

      @@LearnCodeWithDurgesh jdbc ko complete krdo please 🙏🏻

  • @abhishektambewagh6156
    @abhishektambewagh6156 2 ปีที่แล้ว +2

    how to fetch particular data ??

  • @yogeshkuthe8920
    @yogeshkuthe8920 ปีที่แล้ว

    Is this palylist incomplete??

  • @santoshlives331
    @santoshlives331 4 ปีที่แล้ว +2

    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.

    • @LearnCodeWithDurgesh
      @LearnCodeWithDurgesh  4 ปีที่แล้ว +3

      Object nhi banaoge to coding kaise hogi bro...Code ko samjho samjh ayega