Inserting Data to Table with dynamic Input JDBC #7

Sdílet
Vložit
  • čas přidán 15. 07. 2019
  • In this video we will learn how to take input from user and put that data into database table.
    Inserting Data to Table : • Insert data into table...

Komentáře • 38

  • @shivalikagupta3433
    @shivalikagupta3433 Před 4 měsíci

    Even today after 3-4 yrs your content is the best, probably people back in 2020 didnt read ao much of all this. You are awesome, excellent, really.

  • @PradyumnaKJoshi
    @PradyumnaKJoshi Před 3 lety +10

    Dont know why there are very less number of ppl who have subscribed this masterpiece.. Excellent content..

  • @amitsillarkar2609
    @amitsillarkar2609 Před 2 lety +3

    very helpful and easy to learn and understand
    thank you So much bro.......!

  • @ritikbhardwaj4061
    @ritikbhardwaj4061 Před 4 lety

    thanks again for making so awesome video ...your way of teaching is just awesome Bhai

  • @sounaksaha1455
    @sounaksaha1455 Před 3 měsíci

    Easy and crisp.... Thanks Durgesh.

  • @itsynikhil
    @itsynikhil Před 3 lety

    You r doing great job brother, wish u all the best.

  • @ayushkhaskalam6284
    @ayushkhaskalam6284 Před 2 lety

    Thanks bro so helpful

  • @adad8795
    @adad8795 Před 3 lety

    Awesome 🔥

  • @ranirathore4176
    @ranirathore4176 Před 2 lety

    nice explanation!!!!!!!!!!!!!!!!!!!

  • @pushkargoyal4278
    @pushkargoyal4278 Před 3 lety

    wow i first time heared about bufferedreader instead of scanner class

  • @microcodes6887
    @microcodes6887 Před 2 lety

    Too nice

  • @prathameshrambhekar4792
    @prathameshrambhekar4792 Před rokem +2

    Sir one big problem I took 4 inputs like id, name,city, salary then I taken user input and run the program two user input like name and city compiler asking at a same time and taking only one input for two values what should I do sir please reply me

  • @sagardhankar1449
    @sagardhankar1449 Před 3 lety

    great sir

  • @HimanshuGupta-ni3pk
    @HimanshuGupta-ni3pk Před rokem +2

    can we take input By scanner class also?

  • @ekansh6267
    @ekansh6267 Před 10 měsíci

    👌👌👍

  • @Aabara_ka_dabara
    @Aabara_ka_dabara Před 5 měsíci

    cleared..

  • @siddheshsalunkhe
    @siddheshsalunkhe Před 2 lety

    What if we use for loop for taking multiple value. I tried this with given example but getting wrong output i don't know why

  • @bloom6874
    @bloom6874 Před rokem

    hi, can you share link of your video where u have explained how to install mysql? I am facing issue with installation

  • @pabitrakumarghorai7623
    @pabitrakumarghorai7623 Před 3 lety +1

    how to take the integer data dynamically?

  • @ganeshsongala1011
    @ganeshsongala1011 Před 2 lety

    bro setString method takes two argument one is index onterone is String if incase having two more columns what to do

  • @gautamnegi6868
    @gautamnegi6868 Před 2 lety

    Why do we use bufferdreader can we use scanner class aswell for asking name and city name???

    • @srschool4298
      @srschool4298 Před 2 lety

      yes both works , buffer reader is just faster than scanner

  • @joywiz1532
    @joywiz1532 Před 2 lety

    Umm can anyone tell me what will be the data type for insertion of datetime datatype in java

  • @rohitkhimavat6355
    @rohitkhimavat6355 Před 2 lety

    Hi, can you please show how can we perform the inserting to table with dynamic input using Postman.

  • @badalbihari7893
    @badalbihari7893 Před 10 měsíci

    Bhai I am getting more than 12 errors after copying same to same .what can I do

  • @bharatchaudhari8733
    @bharatchaudhari8733 Před 3 lety +1

    Bro why used bufferreader instead of scanner can any one tell me your response will help me thanx in advance

    • @dishagangurde3943
      @dishagangurde3943 Před 3 lety +3

      scanner does not accept value after space.. to take input which has space for eg.: address ..we use bufferedReader.. it helps to a accept multiple words as input

    • @bharatchaudhari8733
      @bharatchaudhari8733 Před 3 lety +1

      @@dishagangurde3943 ohh thanx

    • @user-zg3ru3hs2j
      @user-zg3ru3hs2j Před 3 lety

      @@dishagangurde3943 hey isme hum hmara java program kaise dalte hai database me ye to sirf create table kya hai smj nhi aa rha plz bato

    • @siddheshsalunkhe
      @siddheshsalunkhe Před 2 lety

      To accept values after space use
      Scanner sc = new Scanner(System.in);
      // For line including space
      sc.nextLine();
      //For single word use
      sc.next();

    • @siddheshsalunkhe
      @siddheshsalunkhe Před 2 lety

      Scanner is better than buffer reader.
      I read one article if we compare this two things memory could be save by using scanner class.

  • @vishalmishrausername
    @vishalmishrausername Před 4 lety

    InputStreamReader ka use kya hota h?

  • @dishagangurde3943
    @dishagangurde3943 Před 3 lety

    null values inserted in database instead of actual values?? plz help

  • @sabihanaj9792
    @sabihanaj9792 Před 8 měsíci

    Dynamic insert nahi ho raha hai

  • @KishlayRajSanu
    @KishlayRajSanu Před rokem

    #The below program is of my this video
    #I am getting a problem in setting Email_ID. Please, help me out in this program.
    #I can't under standing where I am doing wrong!
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java .sql.*;
    public class Insert2 {

    public static void main(String[] args)throws Exception {
    //Loading driver
    Class.forName("com.mysql.cj.jdbc.Driver");
    //Establishing Connection
    String url = "jdbc:mysql://localhost:3306/new";
    String username = "root";
    String password = "K!sl@y07";
    Connection con = DriverManager.getConnection(url, username, password);
    if(con.isClosed()){
    System.out.println("Connection is closed...");
    }else{
    System.out.println("Connection established successfully...");
    }
    //Creating Query
    String InsertValue = "insert into Bob(EName, City, State, Mobile, Email_ID) values (?,?,?,?,?)";

    //Creating a statement
    PreparedStatement st = con.prepareStatement(InsertValue);
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter Name : ");
    String name=br.readLine();
    System.out.println("Enter City : ");
    String city=br.readLine();
    System.out.println("Enter State : ");
    String state=br.readLine();
    System.out.println("Enter Mobile number : ");
    Long mobile=(long) br.read();
    System.out.println("Enter Email-ID : ");
    String email=br.readLine();
    st.setString(1, name);
    st.setString(2, city);
    st.setString(3, state);
    st.setLong(4, mobile);
    st.setString(5, email);
    //Executing Statement
    st.executeUpdate();
    System.out.println("Value Inserted Successfully...");
    con.close();

    }

    }
    #The below program is of your previous video
    import java.sql.*;
    class Insert{
    public static void main(String[] args){
    try{
    //load the driver
    Class.forName("com.mysql.cj.jdbc.Driver");
    String url = "jdbc:mysql://localhost:3306/new";
    String username = "root";
    String password = "K!sl@y07";
    Connection con = DriverManager.getConnection(url, username, password);
    if(con.isClosed()){
    System.out.println("Connection is closed...");
    }else{
    System.out.println("Connection established successfully...");
    }
    // create a query
    String CreateTable = "create table Bob(EID int(5) primary key auto_increment, EName Varchar(40) Not Null, City Varchar(15) Not Null, State Varchar(10) Not Null, Mobile int(15) Not Null, Email_ID Varchar(50))";

    //Create a statement
    Statement st = con.createStatement();
    st.executeUpdate(CreateTable);
    System.out.println("Table created in database successfully...");
    con.close();

    }catch(Exception e){
    e.printStackTrace();
    }
    }
    }

  • @amitsillarkar2609
    @amitsillarkar2609 Před 2 lety

    very helpful and easy to learn and understand
    thank you So much bro.......!