java Web project Using netbens, mysql , html, servlet (Java Database connectivity)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I loved you one will come again today I'm going to show you connectivity with mask well first step I'm going to create an HTML and then we will connect the HTML page to the servlet so first of all I am creating a demo project for connectivity so I'm using my Nightwing and for creating a new project and Nightwing please go on file and select new project and here is Java babe it's like to the web application click on next here the name of your application my application them is my demo Bev my database sorry database my DB Bev so here you can select the location and all blah click on next so next I am not use any frameworks so finally click on finish IDE is building a project for us so here is my index dot HTML file first I'm going to run it and check my server is and it or not I am using the GlassFish server you can also use single item build a server in Edwin ok to write content my means my everything is goes fine so had I am simple taking two input field before inserting data and database so I am select I am taking input tag type is text and his name is name right name is user name or name like I'll taking a you name and one more food password and another one is button so input type is text summit summit and is M not required so its value value is submit or inside okay so I want I am using the free tech for well formatting close the pita here so fine let's check my view okay here is a button here is a single textbook neither textbook and button is inside so here for facility I'm using the placeholder placeholder for hint username and I'm using a placeholder another place holder is the password we can change the type of password as a password but and use a simple text okay again I'm going to run it here is a simple username and password now I want to create a servlet where we call this where we pass this name and password so now for the firstly we need a form and insert the whole time form now on the submit of this button we create an action and redirect to the this HTML page on the login dot Java page it is servlet and method of sending data as a post now we need to create this file log into Java so we need a servlet file so I am going to use a servlet name is logging and no need to take expansion and if the most important thing is at the information to deployment descriptor BAM dot XML click on finish so ID create a now basic servlet file for us here we are going to call this HTML component so please remove this HTML code and take it a string type variable is a name you can type any you name because to request dot getparameter and there is a name which you insert in I order a statement html5 you name as you name is same as this name is a boss so I catch the one variable this one and I want to sketch another one so I take one more string type variable like pass equal to request dot get parameter and they pass pass okay I have a two parameter string here is a mirror okay spelling of steadiness okay now I done my job so I am going to run it again but there is no database connectivity for demo I am pausing the demo and password one two three and inside page is it electron ligand or Java but there is nothing passage so I want to I want created database so for database I'm using the MySQL work events and muscular it of is so for creating other database in MySQL you simply click on this icon and here is a database name so my editors name is my levy and click on apply and apply finish you just need to create a database name here and check your databases dated or not click on this rough reference I call there is a my database may be and you don't need to use the masculine commence now now you use in your net when ID so click on services and go on database and here you can check the MySQL server localhost right click on this and sorry if you are not started it too so you can start in but I am already started so cone click on plus sign and access all the database layer so I am click on my TV and connect to my TV so ID is create and connection between to my TV and my DVD 8 hours and I doing so it give me an URL like this one my DV this one so on going with this on this URL and check my database and I want to create a table there so I am right click on this stable when I click right click and click on a great table there is a table name so I am create and their name is logging or user I am going to write it to you go ahead column first name is name and you can select the name type this camp leg for demo purpose I'll select the text you can use work here in all another one is my pass again I take it text you can take anything you want click on a clay ID is creating a table in my database my TV okay it's done you can see here the table username and there is a name name impossible so now my data is done I am going to create my going man invalid file and create a collection database connection so for creating a database connection I am simply creating Java class and my default package for creating a connection so the our class in this class class name is my DB a database click click on finish and I am taking a variable of connection type connection cool is name is Cohn ID given message for import connection class which is provided by the scale package and I am going to create a method of leak connection you get on the method name is get on in the type of Methodist connection is given here for its asking about the return type return of method is gone here I am going to load into our so simple in Texas class dot full name here you need to pass your driver string and the 2nd one is driver dot manager sorry driver manager doctor manager dot get connection net connection and you are passing your database link and database username in database password first I am going to here reminded of his username is root and my recharge password is root so we need to pass their phone string and either if air is also honest thing so forget the system you simply do not remember this go on a service and you don't need to remember the whole length of please go on a service and search for your link is linked this one is provided by the ID so right click on this link and click on a property select the air that driver class this one copy this string for loading the driver simply control see I used for copy and here passed it it's done again go link and property and check here for driver you can copy simply until your database not hold string only till the database okay close and pass it here now there is a mirror it's force for the trike is blocked so simply click on this module this bulb and I click on surround the statement bit takács so when it is gone and there is again so simply copy this link and paste it in and try block again a day one catch or closed ok it's done my method is done now I need to call of object of this method my DV DV equals to new my DV and call the method for connection get on and store the valuable in the connection type connection on possibly so you need to import them SQL package and now you need to a create a statement con dot J statement okay now you will need to improve the statement and a day cache block simply click here and add catch okay now execute a query for insert data in a database a statement executes update for inciting data this one so insert into table image user and name and pass uses not values I will do use I am going to pass this one user name and pass so this this plus sign and pass here you and the second value is us okay everything is right okay now let's say if everything is fine you need to your checker I am going to print a message fine that I visit it so I am going to check this one so save all the files of your project and click on run button I think it will be given error I am NOT inserting a file demo there is nothing because we need to inside and check elector in library some click on libraries properties and click on edge our folder and select there the mask you'll connector and import it click on OK okay let's check it again on when there is again some problem okay in the whole process I found error and a service you have where you create in connection of database so right click on this and please click on connect i forward it and just I connect it my quadrant well so I am going to show it again click on run and Here I am passing user 1 user so concert so everything is fine data is inserted so now I'm going to check my database and here is my database my DV and I am passing the Curie select a strike form user so here is my user 1 and user as I pass a mode user 2 and password is user click and again check my database the user to and user so connectivity is successful so I am going to revise it again so simply you take your you create your database and database and connect it to by the your Nadine and in Edwin you simply need to create an file file name is HTML file and X dot HTML this one and here you need to some input text and to text field and one button and again go on your log into Java you need to carry and you need to copy this this one and take the variable username which one user is pass and pass and you need to create an object of connection class and then create in a statement and pass the Curie okay thank you so much for watching if you liked please subscribe me if you have any doubt please comment me I will solve you thank you so much
Info
Channel: Codebun
Views: 134,458
Rating: undefined out of 5
Keywords: jdbc, java databse connectivity, databse connectivity with mysql, jsp, servlet, netbeans, mysql, hmtl, jdbc odbc, java data base connectivity using mysql, database, JDBC tutorial
Id: akW6bzoRcZo
Channel Id: undefined
Length: 18min 29sec (1109 seconds)
Published: Sat Feb 13 2016
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.