Inserting Data to Table with dynamic Input JDBC #7

Поділитися
Вставка
  • Опубліковано 2 гру 2024

КОМЕНТАРІ • 39

  • @shivalikagupta3433
    @shivalikagupta3433 8 місяців тому +3

    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 4 роки тому +11

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

  • @rohansawant3441
    @rohansawant3441 Місяць тому +1

    Helpful..🤝

  • @sounaksaha1455
    @sounaksaha1455 7 місяців тому

    Easy and crisp.... Thanks Durgesh.

  • @amitsillarkar2609
    @amitsillarkar2609 2 роки тому

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

  • @itsynikhil
    @itsynikhil 3 роки тому

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

  • @ritikbhardwaj4061
    @ritikbhardwaj4061 4 роки тому

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

  • @prathameshrambhekar4792
    @prathameshrambhekar4792 Рік тому +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

  • @HimanshuGupta-ni3pk
    @HimanshuGupta-ni3pk 2 роки тому +2

    can we take input By scanner class also?

  • @SKILLCRYSTAL
    @SKILLCRYSTAL 3 роки тому

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

  • @ayushkhaskalam6284
    @ayushkhaskalam6284 3 роки тому

    Thanks bro so helpful

  • @bloom6874
    @bloom6874 Рік тому

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

  • @siddheshsalunkhe
    @siddheshsalunkhe 3 роки тому

    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

  • @adad8795
    @adad8795 3 роки тому

    Awesome 🔥

  • @pabitrakumarghorai7623
    @pabitrakumarghorai7623 3 роки тому +1

    how to take the integer data dynamically?

  • @pushkargoyal4278
    @pushkargoyal4278 4 роки тому

    wow i first time heared about bufferedreader instead of scanner class

  • @gautamnegi6868
    @gautamnegi6868 2 роки тому

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

    • @srschool4298
      @srschool4298 2 роки тому

      yes both works , buffer reader is just faster than scanner

  • @microcodes6887
    @microcodes6887 2 роки тому

    Too nice

  • @sagardhankar1449
    @sagardhankar1449 3 роки тому

    great sir

  • @bharatchaudhari8733
    @bharatchaudhari8733 4 роки тому +1

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

    • @dishagangurde3943
      @dishagangurde3943 3 роки тому +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 3 роки тому +1

      @@dishagangurde3943 ohh thanx

    • @user-zg3ru3hs2j
      @user-zg3ru3hs2j 3 роки тому

      @@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 3 роки тому

      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 3 роки тому

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

  • @ganeshsongala1011
    @ganeshsongala1011 3 роки тому

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

  • @rohitkhimavat6355
    @rohitkhimavat6355 2 роки тому

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

  • @joywiz1532
    @joywiz1532 2 роки тому

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

  • @vishalmishrausername
    @vishalmishrausername 4 роки тому

    InputStreamReader ka use kya hota h?

  • @ekansh6267
    @ekansh6267 Рік тому

    👌👌👍

  • @badalbihari7893
    @badalbihari7893 Рік тому

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

  • @Aabara_ka_dabara
    @Aabara_ka_dabara 9 місяців тому

    cleared..

  • @dishagangurde3943
    @dishagangurde3943 3 роки тому

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

  • @sabihanaj9792
    @sabihanaj9792 Рік тому

    Dynamic insert nahi ho raha hai

  • @KishlayRajSanu
    @KishlayRajSanu Рік тому

    #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 2 роки тому +3

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