• Thursday , 14 December 2017

Java JDBC Tutorial – Part 2: Insert Data into a MySQL Database

Code Canyon



NEED TO LEARN JAVA? – 5 FREE JAVA VIDEO COURSES – CLICK HERE – https://goo.gl/7i95F8 — View more videos on my “Java JDBC Tutorial” Playlist: …

Original source

3d Ocean

Related Posts

32 Comments

  1. ngu jason
    October 10, 2017 at 11:38

    very great video but please sir i am a little confused here i am wonderng if i have to create a connection each time i wwant to update, delete , add and read value?
    thankyou

  2. Rajnish Singh
    October 10, 2017 at 11:38

    Hi, i have couple of questions?
    1. where to load driver because without loading driver don't know how it's working? like: using class.forName(" ");
    2.without closing jdbc objects it will work but it will give poor performance, so you haven't closed the jdbc objects, please tell me about this in details, please…thank you

  3. shokhrukh suvanov
    October 10, 2017 at 11:38

    Hello Sr How are you? Thanks for helping Do you have a tutorial as JDBC how to work with JSP file?

  4. MadeIn India
    October 10, 2017 at 11:38

    awesome! very helpful.

  5. Nicolas Bohnenberger
    October 10, 2017 at 11:38

    Hi!

    Question: let's say I want to make several insertions into different tables. Do I need to close connection between these insertions, or only at the end of it all?

  6. shiva Rebel
    October 10, 2017 at 11:38

    Error: Could not find or load main class com.mysql.jdbc.DocsConnectionPropsHelper.

  7. Mohammad Nadeem
    October 10, 2017 at 11:38

    Hi Sir, I must say that your videos are damn helpful for every student thank you so much for your kind help. sir I have a problem in my project, its not connecting with the database it show,(java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
    java.lang.NullPointerException) . what is the user name and password I don't know please help me asap to resolve this , its very important for me… @luv2code

  8. ElGiganto17
    October 10, 2017 at 11:38

    Hey, did you know your videos are used by schools? They're really helpful, much better than what my actual teacher is trying to teach me as well. Thank you for the very elaborate but also very thorough and clear videos on how to use this. Also really appreciate the dedication you seem to have to responding to questions by your viewers. Very admirable.

    Also HU represent!

  9. Keith
    October 10, 2017 at 11:38

    im getting this error please help
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/demo","root","root;");

    Tue Apr 18 10:36:18 SGT 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
    java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)

  10. Patrick Enriquez
    October 10, 2017 at 11:38

    I use textfields and button for my registration form or in short i have gui for inserting data in my database anyone have code for that?

  11. Life of Louie
    October 10, 2017 at 11:38

    mkay?

  12. Brahma Dev Thakur
    October 10, 2017 at 11:38

    My problem
    Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

  13. ANKIT GUPTA
    October 10, 2017 at 11:38

    where does the id come from … you did not insert id with the values

  14. Subhajit Saha
    October 10, 2017 at 11:38

    Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification

    Sir this exception is showing..what should i do?

  15. Veena Prajapati
    October 10, 2017 at 11:38

    @luv2code
    what if the user wants it own data to get inserted.
    like in output he can entered the desired input and that data gets inserted

  16. Deepjit das
    October 10, 2017 at 11:38

    don't we need to close the connection?that is myConn.close

  17. Rodolfo C. Tagolimot III
    October 10, 2017 at 11:38

    sir do you how to make connection to database using web.xml only?

  18. francielly patrícia klein chicoski
    October 10, 2017 at 11:38

    Hello sir, Could you please give me an example about how it would work if I had a foreign key? I have a postgres BD and I'm trying to do it with JDBC ,but got stucked trying to do it… Congrats for the initiative… 😉

  19. accentor713
    October 10, 2017 at 11:38

    how do i put the put the driver to access the database with java on the same classpath using notepad++

  20. Talkonn
    October 10, 2017 at 11:38

    hi chad,
    i have 2 questions.
    1. what doin these try{} catch(){} functions? and the 2. for what is this exc.printStackTrace();???

  21. The_BloodHound
    October 10, 2017 at 11:38

    This helps so much! Thank you!

  22. Kozz
    October 10, 2017 at 11:38

    You sir, made it really easy! Awesome narration! Thanks and cheers! 🙂

  23. sharifa bahar
    October 10, 2017 at 11:38

    Hi sir , what should I put on user and password in the connection part ?
    Your videos helped me a lot . Thanks sir

  24. Jeb B
    October 10, 2017 at 11:38

    It's really helpful to me sir. The tutorial is comprehensible and simple. Thank you for this. Keep up.
    I think we don't need to download Connector/J since it's already included in the MySQL Workbench installation. Am I right?

  25. Mateusz Czarnecki
    October 10, 2017 at 11:38

    How do you automatically insert ID? I made the same app and have to do thing like this:
    String sql = "insert into shop" + "(Name, Adress, Phone, ID_Shop)" + "values('xxx', 'xxx', '111111111', '6')";
    Something like this doesn't work:
    String sql = "insert into shop" + "(Name, Adress, Phone)" + "values('xxx', 'xxx', '111111111')";
    I guess it's about default value of ID. But how and where can I set it?
    Anyway, thanks for your lessons, they are great and very useful 🙂

  26. Soumya Shyamasundar
    October 10, 2017 at 11:38

    How do I create a table in the database if I have data in a LinkedHashMap? I am not sure how the keys/ids are assigned?

  27. Kuya Waha
    October 10, 2017 at 11:38

    sir i am using geany in my laptop we are programming mysql but we are acceptable to use only JOptioPAne what should i do?? pls help

  28. Pankaj Kumar
    October 10, 2017 at 11:38

    awesome tutorials … loved ur explainations.. 🙂

  29. Andrew Lira
    October 10, 2017 at 11:38

    Hello. Im using Python to make a program and I want to connect to MYSQL. I have installed MySQL 5.7 but when I try to connect it with Python it says this error: SSL connection required but not supported by server.

  30. WorksFine
    October 10, 2017 at 11:38

    can i make this with scanner to input the data in console ?

  31. WorksFine
    October 10, 2017 at 11:38

    I've added the driver but im getting this error what should i do?

    java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:896)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:885)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
    at com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:465)
    at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1325)
    at ariandb.ariandb.main(ariandb.java:19)

  32. Brian J.
    October 10, 2017 at 11:38

    Good Lesson, Thank you. B

Leave A Comment

You must be logged in to post a comment.