How to Create a Student Database Management System using MySQL in Java NetBeans - Full Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi and welcome to javanet being student database management system developed using mysql let me show you how this works if i click on this very table there we go you see the details of this particular student grace kings grace is meant to be a male that means the database is wrong look looking here that's a male gender so all we can do is we can come in here change and come right in here you see where we have update and get our details updated there we go grace is now female and at the same time we can delete whatever record we don't want in here supposing we wanted the leads let's go for frankfurter that's from flash's details in there click on delete there we go confirm if you want to delete from details here the details of prank gun the other thing that we can do is we can add new details name here let's say the name is poor old woman and the address of our woman goes down and in here smell uber number there we go mathematics completed games yes data science complete analysis completed english there and so on just enter all of the grades in there now that we have all the information of paul woman let's come right here you see where we have art click on add student record added click on okay there that's the details of paul roman we can also print if we want so let's hit on print click print and there we go so let's set up the print so let's go for landscape and instead of printing because i don't have a printer in there i'm going to select pdf and hit springs printing in progress all right let's give our printed work a name i'm just going to call it [Music] all data and save that straight on the desktop save and let's go straight to the desktop that is impulse data click double click on that and there we go that's pause data so let's go to view and just rotate that there we go guys that is pause data see that guys okay so what we're going to do now is i'm going to take you guys straight into javane bean and we put one of these together so let's do that now guys hi and welcome to java tutorial for student database management system to be developed using java netbean using mysql i'm going to start by clicking on this icon here that's for new or you can always go to file and just select new and i'm going to select java right there and click on next all right yeah i'm going to give it a name i'll just call it student db my just sql that uncheck the create main class and click on finish and let's go to my project here it's called studentdb mysql that is it right there i'm now going to right click on it and let's select new and we select jframe jfram form and then i'm just going to give it the same name and we will have a package give it our same name as well and click on finish there we go that is our application right there now i'm going to right click on it go to let's go straight to the properties and in there i'm going to change this to 1460 that would be the width the height will be 800. i'm going to get it centered check center and click and close that and right click on the frame itself and let's go to where we have set layer i'm going to select absolute layer you must do that guys select absolutely now let's head straight to the pilot right here click on panel and just drop it right there now see this very panel i'm going to drag that much and all the way to the edge here that's fine and just reduce here and now let's go to the properties of that very panel i will now select where we have thing properties let's go to the border click on the border and now we want to select bevel set bevel let's select slurred there we go and click on okay and that is it it's lowered in that is fine you can select whatever you like but i've just selected the word now the next thing that i want to do is i'm going to copy that same selection of panel let's copy ctrl c and ctrl v paste drag it that much okay and let's take it right there okay um now i'm also going to select another one of this let's copy and paste it right in there paste in here and let's change this okay now if you guys notice this destruction on my phone why because i was meant to right click and let's select set layer and i'm going to make that absolutely the reason being so that i can paste my object wherever i want but without that you are sort of like restricted and the same thing applies to this one as well let's make sure it's absolute layer and this one should be absolute layer as well and yeah i think i've done that to this absolute layout okay this very one now i'm going to change the whole appearance of that let's go straight to the border here and i want to add some lines just around the edge of it i think i'm going to go for this and let's change that to about four the thickness let's change the color to i'm going to select rgb and i'm going to change that very color here to cadet blue five f nine e a o okay that is it five f nine e a o this and all missing yeah that's it click on yeah click on okay and as you can see the color there okay it's giving me that so i couldn't even change it right here okay that's fine now we know all right so that is done so i'm going to drag this that much and copy ctrl c ctrl d paste there i'm going to need one more of those really that much yeah that's fine now copy and paste and this that i've just copied and paste i'm going to bring that right down right here hold drag drop it here and just drag it that much all right that is fine so might as well just add some buttons right here so select the pilot click you need six buttons there remember that much just copy and paste first and first let's change the font size of that very thing too let's do it for about maybe 60 we can always change it i think 60 might be too much listening for okay that looks a little bit much better so i'm going to now just right click on it change the content i need to that would be my exit all right just drag it down that seems a little bit too large the font okay let's let me set it for 36 all right just copy paste copy that paste that's two so i have six of those there yeah that's fine but making changes to that all right now up here let's open in here let's grab a table there where is the table table there we go that's a table there now we're gonna paste that right there just drag it that much and let me go straight to the properties of that very table where we have model let's look for select that yeah there we go that's it right there click and let's change as follows this i'm going to call this id and the next will that will be student student id and this will be first name and i have sworn in here let's add more we don't need more those this soil should be underneath add more here we're gonna need about 16 change that run and i'll get back to you guys and there we go guys and i've also deleted this there is four in there so if i click on okay this is what you will see but we don't want those four rows so get rid of those four rows just make it zero we can always increment that as we want as we go along so that is it right and up here let me just add a label up there so let's come right here label place that in there and change the size of that very label i'm going to change it to about 60 and the fonts let's enter student database management system in there there we go i think i should make it bold very easy to make that bold all right it's more pronounced yeah that's cool all right i like that okay let's add some labels here and text box as well label then i'm going to need text field see these three objects let's change the size to something a bit readable make that bold we can always change it around if you don't want it there we go and this is going to i'm going to change this to student id and let's get get rid of the text content in here delete and that is going to be txt student id and where is it selected let's change to txt student id and copy it across let's scroll down to the control copy paste i'm showing the whole process because of those who might be new to all together so at least you have a very good idea of what you're doing right that's why i'm showing the whole process i can always speed that up for those of you who are experts you can always speed it up this is going to be the research chapter for you guys to click on on the description area all right so that is going to be for copy this let's copy this first paste and this will be for the mobile number okay as well this is for gender right and right in and let's change the appearance of the part now let's go to the border here and let's change that border to uh maybe a thing barreled and just lower it as well click on ok yeah that's cool now hold on to the control copy paste and there we go right now let's copy this copy and paste this will be for this subject you see that line again so i'm going to have to change that right click set layout absolutely okay so that's disappeared i mean let's delete this copy this already set layer of one paste it in there okay now let's copy it again copy and paste that in there right there so i can paste it anywhere i want now back into my design copy that paste copy again paste all righty and i'm going to copy the full copy and paste it in here right so the interface is coming up and right here let's change the name of this one to oh first thing first let me change all of these to bold them all to now the text on this one is going to be add new right and change the fonts from btn add new so i'm going to repeat the same thing for the i'll get back to you guys but that's how it's done so this one is going to be print and let's just speed that up okay i'll finish up with the names of this so let's take care of these ones too so i'm going to click on that and as you can see i've already entered some data in there all you just need to do is to go to the models and enter whatever you want to enter in there it must have a comma so that you can have them in order that you want okay now let's give it a name right click on it and select the variable i'm going to call a cb oh that would be enough that's fine then the next one i'm going to call it cbo games cbo games and i'm going to repeat the same thing for the others and that's it all taking care so now let's come in here i'm going to change that to txt student id the next one will be txt first name so i guess you guys get the whole idea so i'm just going to repeat exactly the same thing for this txt surname we have address txt address and this is going to be txt mobile txt over right and this is already taken care of yeah okay that is all the naming's taking place so let's run it and i'll just show you guys how it all looks like run and there we go guys that's how the whole system looks right now so all we don't need to do is to start work with some coding so let's take care of this first all right now straight to the exit here uh right click on the exits go to event action action perform um right underneath here inside the exit itself i think the first knob i'm going to do is i'm going to create an object there so let's say j frame and it's going to be our frame there all right so you see that error so you can just click on it and import your javax swing there and in here i'm going to enter frame equals new jframe that's the object now and this new jframe let's just give it a name i'm going to call it exit close that there now the next thing we're going to do is use a new statement if j option plane without let's go for sure show configuration of show config okay show confirm dialog let's enter dialog in there show confirm dialog in there i'm going to open up a bracket and the object that i've just named them will call out frame command and this object let's enter some the first argument is going to be confirmed if you want to use it there that's my very first argument the second argument is going to be the name of my application i'm going to just call that student management systems that's fine okay there's going to be another argument there let's say comma press enter and i'm just going to call j options is that in there and that would be dot yes yes no options okay so i would then say equals j options there's just no option yeah let's pump down here block equality bridges and inside our core bridges that means if yes is selected then we want the system to officially exit dot exit there we go so that is my exit lines of code taking care of all right save that let's go straight into oh let's do one thing first let me create a database then we can start work with that let's select my database here and in here as you can see i'm using the mysql workbench okay if you don't have this you can use um phpmyadmin okay it's the same the only difference is you don't have to use if you don't enter password in that you don't have to use that you don't need to enter password i mean but this one you do need a password so i'm going to select this schema click on schema and then i'm just going to give that a name i'm going to call it student data yes then data that's fine i'll copy that then click on apply and that's my schema created click on apply again it's successful and click unfinished there we go now right underneath i should be able to see my database there we go that's right there this very one okay so i'm going to click on drop that down that's the table right click on the table click on create table and give your table a name so i'm going to call it student database as well that's the name of my table right there so in here you see this double arrow drop it down and now the column the very first column i'm going to enter in there that will be i'm just going to call that id and this id i'm going to make that let's say the id is going to be auto increment all right so automatically to increment anyway let's make it the unique number as well okay now underneath here i'm going to enter student id okay let's say student id in lowercase okay then uh followed by the student id i'm going to make that yeah primary key as well it must be it must not be empty it must be unique for each student okay each student must have their own the id now underneath here i'm going into first name then we have sour name address okay and then we enter the gender after gender so we enter come in there and just enter the mobile number contact the student and then we enter all of the subjects after the mobile number the very first subject that will be nice and underneath press enter games all right i'm going to speed all of that up and get back to you guys and now finally here i'm just going to enter english right there there in total i have 15 fields there we go so i'll leave all of them as character i'm going to change this student one i think maybe we should change it to student number or yeah change it to number as well okay that's fine the id and the student number okay that is fine so let's click on apply there we go there we go where is it here all right click on apply we have it all all together that is okay that is 15 the table all right click on apply that's it finish right let's go back to let's go back to our design right and that is it all done for that so i've taken care of the exit so let's you can run that and see how the exit is going to look like yeah if i click on exit there okay i'm going to say no i don't want to exit before i go any further what i want to do is to go straight to the project here and i want to add the driver to my system here so i'm going to just contrary to the library right here so i believe you guys know how to download that so what we need now is the java driver so right click on it and let's select add jar okay just click on that there we go i officially have my jar files there that is it you can always download that's just called mysql connector java you need that okay i'm going to maybe just select the two okay all right let's click on ok open there we go then they should officially be inside here now let's come right down here yeah there we go now first of all i need to import the following let's import the following libraries the connectors the preparation statement reset and so results table and so on so those are the libraries that i'm going to need the ones i don't need i will get rid of it for now let's just continue now underneath here you see right underneath my class here i'm going to enter the following let's say private i say static and i'm going to find out um this that would be username let me call the username first and the username in this case for my database is just called root okay now i'm going to call the others or this should be private okay let's copy this and just change the race around all right this one is going to be password okay for my password see okay that's my password and in here that is going to be my database let's just call it data com data connection okay and in here i'm now going to enter jdbc and enter column my sql column slash slash forward slash local host and this local horse is is on 3306 i think it's almost the same for almost everyone anyway and my database name is called student data i believe i'm right that's the name of the database let's check one more time yeah that's it student data yeah let's copy that and compare and compare that is it student data okay so that's the name of my database i'm just getting rid of this yeah so my database is in place i've just connected to my database now underneath here okay the next thing is i'm going to create a session between the java application and the database itself and i'll call it connection so let's say connection and i will just call it sql time equals nothing there i am also going to create a connection interface and that's going to be prepare prepared statement so let's come in come down here just enter prepared statements and i'll just give it pst that is going to be nothing as well then another prepared statement would be the result result and i'm just going to call that rs equals nothing there we go let's enter a column there this should be prepared right okay so i have my connectors in place okay the next thing i want to do now is i'm going to come in here you see where my art button is right there so let's right click on it and select event action and action perform right in the procedure area of that very button let's delete this comment first i'm going to use try and let's say cache and in there the first thing i'm going to do is i'm going to say class dot for name there we go double click on that and this name that i'm going to refer to would be khan with mysql dot jdbc dot enter the driver there we go and let's come out here and just enter semicolon now the next thing i want to do is if you guys can still recall the object i created up there for the connection that interface with my database that is sql con yeah that's what i called it let's highlight all of these so that we know where we are yeah that is it right there so scroll right down sql account and equals driver that will be driver manager and this driver manager dot get connection or yeah dot get connection and that is going to be where my database the icon that takes in my database is called data connect that's right that is it right here there i'll come right down and the i also need a username and password is a command username so and password come out here and just press enter it's a main call all right let's take care of this cash there should be a cash here i can i can just copy those here let's come right down here somewhere here right here let's drop this down i should be able to see my cash statement instead of reinventing the whole wheel so up to i'm gonna need to statement there grab these two copy and let's come right on here if you have to do the same thing make sure you don't mess up your own system so i'm gonna come right down here just enter that there okay that's my car statement but this one i'm gonna change that to sql that should be com sql so get rid of this and change that to sql and that takes care of my cash statement and that error that you guys were looking at is all gone all right so the next thing we want to do now is i'm going to use the pst to prepare my interface so pst that is going to be equal to sql dot prepared statements and right in there i'm going to enter the following sql statement so let's get rid of this uh my statement is going to be let's say insert because i just want to enter data anyway insert into it's called students data that's the name of my database and set into student data the following so it's going to be i'm not going to be calling the id i won't do that so i'm just going to start with the name and set name because the id we actually automatically increments itself so surname i have a dress i have addressed it this should be comma in here and i have gender then we have more and what else do we have have okay there should be student id right up here so student id right games data science analysis we have graphics database what i do i have i have science and i have english there we go in total that should be 14 and this should be known as games okay so here the next thing i'm going to do now is i'm going to say represent these by values and let's press enter again and the values that i'm going to enter in there i'm going to use question mark that's one in total i'm going to enter 14 of those copy that that should do it that's 14. okay close that up here close the bracket up and get rid of this then we enter a semicolon here okay that should do it then the next thing is i'm going to now specify the string value so the very first one is that india dot let's say set string and the very first frame that i'm going to set is going to be let's call that number one and that is going to be txt first name no that's not number one that's number two actually that's number two let's say dots it's text all right this one is not number one it is number two yeah number one is the student id copy paste right all right the very first one is txte students id so that's number one and the second one is going to be first name i think that's uppercase right then we have sony change this one to four name we have an address okay that's three four then we have we have gender and so on let me just speed this up let's address this gender then i have mobile agenda let's say mobile let's see what that one is called oh it's cbo okay let's go back in there cdo there all right we have an error here the first place we need to convert it to string character because it's going to recognize it as an integer let me show you guys what i'm talking about so let's say dots get this selected item yeah there that is the correct okay that's the correct function for it but the problem is this is recognized as an integer value so i need to then convert it to this string value there we go and the next one as well i think this is seven yes let's change it that's eight i think the mobile is fine this one is going to be that the cbo as well cbo that will be i think that is math okay but there's going to be an error as well so let's just copy change and let's grab this in fact the rest are combo box so i might as well just copy and just change the names around right so let's change the names around the rest are all subject seven is math then this is eight i have eleven here 12 13 and 14 so let's change the subject names so this one is going to be games and this is in data science i called it right with the science we have analysis the system analysis let's say yeah that's correct and what i do i have of the system analysis i have graphics i can't remember this unless there okay that's fine um database then we have science then finally we have english day there we go oh that's incorrect yeah let's see english what did i have in there oh there's an h missing so let's enter the h [Music] copy and save that go back in there yeah that's rectified okay the other thing i'm going to do is i'm just going to add a message to confirm that i've updated or that the system is updated so let's grab this i think maybe show yeah message this and come right down here but before then we have to get it executed force pst dot execute update there we go enter that and let's just display a message like i say daily run um get rid of that so that should be show message okay you can change that to secure message box show message dialog and the download let's just say this record added i'll student book about it student record added there okay so all i'm just all i just need to do is do now is let's try it out i still check that we are able to enter some data in there so this is my database there's nothing in here for now so let me refresh it and so that you guys see the whole lot go to the table there that's my table double click on that and you should be able to see that there's nothing in there it's coming up there we go there's nothing in there but there's going to be there's going to be an arrow because i noticed like database that is supposed to be a reserved word i believe but just to be on the safe side i'm going to come back in and just change the name of that unit to do the b is one else there will be an error i have that feeling so i'm just gonna call it database one here put a one in there save that and i will also do the same thing for my for the connector and there this say finish let's come in here and here i'm gonna just add one there and oh look at that there's a bracket missing there so you need to close that up and close this up okay let's save it and give it a try and see i'm going to now compile and we just run it well let's click on run let's take it from there there we go so i'm going to enter student id in there and here i'm just going to say the name is sally southend and in here is going to be number 27 hilltown road london and here that's going to be female telephone number all right let's say math completed games that's a call unit complete yeah no let's say hey and let's complete this as well only one left so all you need to do is click on oh there we go successful there so now let's check our database come right here that's my database in this so all i need to then do is kind of like refreshing just click on the database that is it those are sally's details so the database is working that's fine now let's go back okay now what we need to do is i want to make sure every single one of these data appears on this very table so i'm going to exit out and okay i'm going to create a function but let me just copy some of these i have to use them so [Music] now let's grab it all and i'll go right up then just create a function there copy and let's go right up here okay let's see right here that's fine and i'm going to just enter a broken line with a comment i'll just call that function declaration right and let's enter another broken one here i just want to know where my functions will be now let's give this function a name i'm going to call it let's say public and we say public void i'm going to call it update update db enter parenthesis come right down here and the copied line stock code i'm going to paste that in there and delete as follows let's come right here and i'm going to delete from here i don't need all of these let's get rid of all of this everything here come right down here yeah get rid of that and i will also get rid of this just from head here right and what else do i not need i want to get rid of all of this and maybe i'm going to change this the sql statement i'm going to change that to let's say select select all from student student database and close that okay so that is that so let's just close this try there and that should do that let's come right down see here does it okay so all right now i'm going to just continue so right underneath here i've already entered my sql statement so have a good look at that i may have to change this i don't know yet okay so let's use as follows so i'm going to call my results sets let's see my result set equals p st dot execute the query yeah and enter parenthesis okay and semicolon now i'm going to i'm going to save results set the metadata and this my message metadata i'm just going to call it st data and st data equals let's say is equals rs dot which is the result set gets metadata there we go okay now that is in place we also need to do something like let me declare a variable right here i can just call that and keep so i'm now going to make use of q so let's say q equals student data is very one and that's going to be dot get count column counts and we also need our i'm going to need the table so let's get the that's going to be the object for the table okay default table another table mode what shall we call it we're gonna call it record yeah okay red card table so for the record table i'm going to say equals open a bracket and that's going to be the default table mode instead of typing out of that paste it in the bracket copy and paste then and my table has my name is just j j table 1 dot get mode there we go so record table that's the name of that's the object i created for the table now we now want record table to set let's copy that record table dot set rule count there we go and the row count is zero yeah so we're getting somewhere that's good no arrow now what we want to do is we now need to use while loop so let's say y result set dot next open and close parenthesis and entire coil braces press enter i'm now going to just say let's say vector i'm going to have to import something vector cloud column column data so that's another object equals new vector there now we use a for loop so let's go for for i for let's declare another one here i'm just going to put column i here come right down here for i equals one comma i less than an equals to q i plus plus all right so once we've done the axis open another coil of bridges and inside these coil braces i will now call my column data place that in here this column data dot add result set dot get strings and this strings the very first one is going to be my id that's the very first one and to that the second one is going to be student id you know copy that come right down here paste paste we have student id and here that will be first name we have sewn in we have sewn in here [Music] then we have address we have to speed this up because i'm actually calling every single column on my table speed that up so before we speed that up we have this supposed to be column let's correct this value and i'll just speed it up okay let's be down okay so i've actually speed that up so what i need now is i'm gonna get the record table which is the name for my table so in here i'm going to then enter record table dot add double add rows and the rules that i'm adding is going to be it's going to be this column data paste and there now the next thing that i need to do is to actually call initialize this function that i've just created let's make sure there's no error so let's copy this function we need to get it initialized come up here right underneath here page and tested me color okay we need to try this out but before that look i've made it i've made a mistake again you see here that is a reserved word so i'm mistakenly called one of the unit database okay i'm just going to add one to it so that there won't be an error look at this i was meant to close my for loop let's come in here and get up close here and delete this else there'll be we've just been looping all over okay so that is yeah the error is okay let's run it maybe i should change this i don't know let's look for my exit just copied out of exit right you can just yeah maybe use this yeah okay that's just a message box so i'm gonna come in there i've already got it initialized so i just want to tidy up things before we start running this so we'll paste that in there and i'm going to make that message and inside the message is going to be let's say nothing okay that is taking care of us well make sure if you follow my my process of my procedure make sure this database you have one in there you change the name of the database entirely because it seems it is a reserved word so i'm going to now run it so if it's working fine i should be able to see the database on my system and make sure the function is also called here right here inside the initialize make sure you call it that's my function called so i'm gonna run it now save first and run and there we go guys that is a right there okay that's our first data all right let's see let's add another one then we stop it and we run it so so the name for this guy let's enter now let's enter 13 14 johnny an address let's say leader venice and that will be road in london and as female as well mobile number call yes yes and complete and that's a call all right that's 14 journey click on that right if i'd entered this in there i should have been able to see it here okay let's end that and i'm going to copy this you see that i'm going to copy it just to let you know that for teen journey is right on the database i will show it to you guys let's go to the database and kind of like refresh there we go open it up there we go that's 14 johnny and the database okay so the database is working now i'm going to come in here you see this right click event action action perform so when i click on it it should also display i think johnny i think i can paste that in here okay so whatever update made should be displayed on my system so run that again and let's see okay let's enter new details in there that's a new student and this student is let's go for tony one time an undress and he lives in it's a big town road let's go for kingsland and this mail mobile number yes okay that's fine all right let's click on add new yes there we go look at that that's fine so what i want to try and achieve is when i click on any any of the rules here i wanted all the information displayed in here and one other thing i need to be able to reset this but let's do this first so i'm going to exit out and let's come back in here you see the table itself right click on the table and i'm going to go to event mouse click yeah let's use mouse click click on that and right here right there but first thing first let's copy the the object for the table i think it's right up here inside is very function there we go i'm going to copy these yeah let's copy all of these that's fine and come right back here and do that again mouse click there we go right and the object i just copied i'm going to paste that in there and i would then declare let's say inked selected rule selected rules equals j table 1 dot gets selected for and i now need names of this very table so the very first one that is going to be txt i think less of the case txt student id dot set text and the text with setting is going to be from here record record tip place that in here and i would then actually to get the value dot get value at select state row copy that and that is going to be my number one and that would be one that's the strength there right that's the very first one that works out fine so just copy this in total i have 14. now copy these again and paste it there so this would be two and so on and 14 okay okay now if that is this next one is going to be there and followed by surname address then we have gender i believe okay for gender that is cbo gender okay we have an error this is meant to be a kunda box so first of all let's just comment that out and enter dot set selected item should be set selected item there we go this is coming up there we go and i'm gonna now delete all of this here and there we go so we also have this one is going to be mobile so that is fine and the rest are going to be combo box so this one is that would be mass cbo has selected item as well copy that and just paste it right there and all the others are selected item anyway so might as well just replace it all then change the names around here almost there there we go now this one the next one is games cbo games and after games we have data cbo data science yeah then we have analysis here cpu analysis right and after that we have graphics cdo graphic and we have cbo database cdo data base then we have science cpu science ceo science and finally we have cbo english okay okay let's give that a try so when we click on the table we should be able to display all this all of the data on the table so compile and run now run let's see there we go okay click there we go look at that yeah that's fine it's working fine so that's fine now let's take care of these other buttons maybe we'll take care of this first all right exit out here and let's go back in here select the update and come in here click okay so for the updates first thing first you see this data i have inside a table i'm going to just copy that and drop it here there we go and i'm also going to copy these data that we have in here add add new copy everything then just dump it in there copy right underneath here paste and i've actually changed this message might as well delete it delete that for the cry crash out yeah let's delete this as well the choice is yours you can leave this if you want but i just feel i should i'm gonna comment this out and leave the other one okay now let's come right down here that's for try cash for pretty hard and i'm using the different one for the update okay the next thing we want to do now is with the update i'm going to first of all let's declare an integer here just call that id and that better id that's for my that's for the database anyway that's going to be an integer dot press pause and what i will pass in there the content that i have inside record record table copy that and dump it down the object in there and the next thing is i'm going to ask you to get the value that gets that value and the value that we're getting art that is going to be from my role here copy that paste that in here there we go and i'm just gonna give you zero value there let's say dots to spring that should be zero dot to strength okay let's correct all these errors in here that should be uppercase integer now what is this get rid of that all right now this is fine so then all that we then need to do is to change our sql statement here i'm going to first of all get rid of all of this let's just close that and in here i'm going to enter update update that is going to be the name of my database which is student database and set student id it was nothing comma then i'm also going to set the the name that's first name that will be equals question mark as well i'm going to press enter then the next one is going to be surname so i'm going to repeat the same thing for the order for the other columns corner and we have a grace here and so on guys so i'm gonna have gen so i'm gonna speed down and get back to you okay i've entered every single one of my columns in there but one that is missing be that of the id so let's come right down here so the very first one is the student id which is right there then followers first name surname and so on but right underneath here i'm going to enter this ptsd dot that will be set ins because that's an integer value that should be a dot integer okay and that is number 15 and that integer value is my id the one i declared right up there this one okay now so we can then entire messaging here let's just say student record updated right and that's it my function is call up there that will populate the table again once it's updated so let's just give a try and see anyway hopefully there shouldn't be any problem right okay so let's run let's see all right click on run compile first before we run it now run okay so if we select any of these we can go ahead and update it instead of instead of kingsland we can just change that to let's say lagos but let's change this as well so call that old whole candle and that's what you need montana so let's click on update student record updated so we should be able to see old town road let's see that there we go old town road that is fine okay let's take care of print reset and update then we can call it the end of this program so we only need delete resets and print so i'm going to exit out there let's go back in here okay let's take care of the print first so i'm going to right click and let's go to event hard action perform and right here let's get rid of this i'll move it up a little bit okay right there so the first thing i'm going to do is i'm going to create a method there or an object sorry and that object is going to be message format for the header and i'm going to make that new this format header come right in here and we're going to specify the following print or printing improvers hunting improvers improvers that is for the header i think we will have to import a library here let's come in here just click it does it we need to add this library click there we go okay now i need another one so let's call that let's just copy this paste and i'm going to call that footer there for the footer maybe we should enter page number come right in here and let's just say page the page number zero zero comma and that is going to be the number comma integer number of pages in integer format right so i'm now going to use try cash here just a try okay what about my cash statement what would i use okay i can just crash and print printer exception okay double click on that and let's say for e let's come right down here let's display our message here so for the print message i'm going to enter a system without arrow that's for the print arrow about format let's just say no printer found no printer phone there we go connor let's say e dot get message right and that is for my error handler let's see okay and up here let's enter the name of my table that's j table j table one really dot print and that is going to be j table as the name of the object dot print mode that let it be normal normal and comma enter my header and comma enter the footer there we go let's enter semicolon there so that should take care of the print there so we can just try that out and see so let's run it now run okay let's click on the print let's see what's going to happen with the print there we go guys look at that i'm going to print it on here let's print it here a pdf and click on print let's see how that's going to turn out to be to look that's the default name so i'm going to say yeah save on the desktop and there we go that's it right there so i'm going to close that i don't need that anymore with taking care of a print now let's take care of reset then we'll come to the delete okay let's exit out and i'm now going to select resets right click event action action perform and then for the reset let's maybe we should just copy all of this here let's come in here let's go to okay let's come in update and copy the name of the data i'm going to copy all of this let's copy everything now let's go back to the reset event action action perform run right in here paste that i'm going to delete some stuff in there get rid of all of these and change this one to set and let's get rid of that that's the first one taken care of i'm gonna repeat the same thing for the others so get rid of all these first get rid of this as well and copy this let's paste it here right okay we're almost there now so that's going to be a different one so for gender that is going to be yeah let's get rid of the content in this world why the rest will be we could just make that zero here okay the rest will be zero moba okay move out that's correct get rid of copy this and paste it here for all this okay that should take care of our reset so and we are almost there right okay that's that's it taking care of let's get it indented properly that's all um let's take it to the edge and then bring it back there and i'm also going to take care of the table actually let's come right down there there we go that's for the table okay so we'll clear the table as well now let's run okay let's try out this reset i'm going to enter whatever in here and just take it from there anyway let's see let's click on reset this will not totally disappear it's just a reset there we go and if i click on update nothing should happen really okay let's take care of deletes because we can always come back here and there'll be nothing in here so we should be able to delete something like this so let's take care of the delete since reset is working as well so exit out let's come in here select okay action action perform okay to take care of this delete i'm going to have to copy some some stuff here let's come to updates grab everything here yeah just copy that and we come right down to delete right here paste now for the delete to work i'm going to change all of this let's go to reset and change all of that to whatever i have inside reset there we go come right down here copy all of that right back to delete let's go back to delete here and come right down here yeah i replace all of this here delete and just paste that in there now the other thing i want that i will do is i'm going to come up here and then right underneath you i should let's declare an integer and this integer will call it delete item and this will delete item i'm going to let's see okay let's go into exit now i will copy that inside exit copy all of this and we have inside exit yeah let's grab all of these i'm back to my deletes once i get it all sorted properly i'll show you guys this x taught you through so let's say hint delete item equals this message so asking you to confirm if you want to delete so in here let's just enter dot confirm first thing first let's come right down here and comment this one out so i'm just going to say that that would be show okay confirm dialog and inside it the dialog will be let's say no value in this so what we just need to then say in here is confirm if you want to delete delete item right that is my very first argument then maybe we should use warning okay let's say comma we can use warning dialog there that should be uppercase and come out here say comma then we can enter all of these other ones so we'll grab this let's just say that yes or no copy that paste that in here right what is the entire semicolon and i'm going to get rid of this now now i will then use an if statement so here i'm just i've set my variable so i'm going to say if delete item equals this dialog result yes so if this equals equals yes then if the option is yes then what i want the system to do is to do as follows okay let's come right down here okay so let's go down here just close that come right here let's end that today that should take care of that error and okay i'm going to now move all of these let's grab those cut them all off just take it right underneath here and what i would then do is let's come up here and set [Music] [Music] one corner and that would be for the id there we go okay let's get rid of that maybe for the id the yeah then the other thing is okay now let's take care of the sql statement that will actually take care of the delete so right there so all i just need to do is enter delete that is going to be from the student database student database and that is where id is going to be question mark okay and that should take care of all of that right and i've also are the focus there for this text box the student id let's see i think that we that's it for this okay let's let's run it and see how it's going to work compile and then we click on run yeah decision time let's try this out select that and just click on delete yes confirm let's say no let's try it again record delete it there we go that's it it's working all right let's enter new data in the entire they say games james williams as his advice there time clothes and so on so that's it guys we just finished creating our own student database system uh that's james williams there okay guys with that i'm going to call it the end of this tutorial i suppose you guys enjoy it and please do subscribe to my channel and you can also join to become a member of the channel so i'm going to say bye for now and you all have a nice day thanks for watching bye for now
Info
Channel: DJ Oamen
Views: 31,090
Rating: undefined out of 5
Keywords: Student Management System Developed with MySQL in Java NetBeans, Student Database Management System Created with MySQL in Java NetBeans, How to Create Student Database Management System with MySQL in Java NetBeans, Create Student Database Management System with MySQL in Java NetBeans, MySQL in Java NetBeans, MySQL Tutorial in Java NetBeans, MySQL Student Tutorial in Java NetBeans, MySQL Student Database Tutorial in Java NetBeans
Id: Y-FcMzRRpOc
Channel Id: undefined
Length: 103min 6sec (6186 seconds)
Published: Sat Aug 08 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.