Java JDBC Tutorial - Part 4: Deleting Data from a MySQL Database
NEED TO LEARN JAVA - 5 FREE JAVA VIDEO COURSES - CLICK HERE - https://goo.gl/7i95F8
---
View more videos on my "Java JDBC Tutorial" Playlist: http://goo.gl/crT4nS
Closed-Captioning and English subtitles available.
----
In this video tutorial, you will learn how to delete data from a MySQL database using Java JDBC.
Download the source code from here:
- http://www.luv2code.com/?p=758
Please subscribe to my channel. http://goo.gl/EV6Kwv
----
Follow luv2code:
Website: http://www.luv2code.com
YouTube: http://goo.gl/EV6Kwv
Twitter: http://goo.gl/ALMzLG
Facebook: http://goo.gl/8pDRdA
---
Join my mailing list: Get advance notice on new tutorials. Emails about 1 per week.
- http://www.luv2code.com/joinlist
---
Questions or problems? Post them in the comments section below.
---
Want to suggest a video? Leave a comment below. I'm always looking for new video ideas.
Let me know what video you'd like for me to create.
---
Video Transcript
Time - 00:00
Hello. In this video, you will learn how to use Java JDBC to delete data from a database. In regards to Prep Work, you must have a database installed. This demo will use MySQL.
Time: 00:13
You also need to have the database driver configured. Again, we’ll use MySQL. If you need help on how to do this, then please look at my other video “Connecting to a MySQL Database with Java.”
Time - 00:31
In this example, we will use the employees’ table. This table has columns for employee ID, last name, first name, and e-mail address. Let’s switch over to the MySQL tool so we can review the data.
Time - 00:45
As you can see, we have the employees’ table in place. Make note of the entry for David Brown. We will delete this employee from the database. The SQL command that we’ll use to delete an employee is delete from employees where last_name=’Brown’;
Time - 01:09
Let’s move and try development environment and get started. We’ll start with this main program, that’s going to have three variables for the user, password, and the connection information. The first thing we’ll do is we’ll get a connection to the database by saying DriverManager.getConnection, passing in the params. Next, we’ll create the statement using myConn.createStatement. Then we’ll define the SQL query string. In this case,
delete from employees where last_name=’Brown’
Time - 01:43
Now, actually execute that SQL statement by saying executeUpdate and the database will return the number of rows affected. Also, I will print those out. Then finally, I’ll just print out “Delete complete.” so that we know that I’m done.
Time - 02:01
Now, let’s run our application. I’ll right click; I’ll select “Run As”, “Java Application.” Now, let it execute. Now, it will print out the number of Rows affected and Delete complete. Now, let’s move over to our SQL Query tool and very the results.
Time - 02:24
If you note here with the previous entry, we had a listing for a David Brown. I’ll refresh this Query, and now note that David Brown is gone. A Java Application was actually successful in deleting that entry.
Time - 02:37
Great, so in summary, you learned how to use Java JDBC to delete data from a database. If you would like to download the source code, please visit luv2code.com.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java JDBC Tutorial - Part 4: Deleting Data from a MySQL Database», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.