53GB

How to connect HTML Form with MySQL Database using JSP | Registration Page Example



How to connect HTML Form with MySQL Database using JSP | Registration Page Example

In this video I have shown you How to connect the HTML registration form with mysql database using JSP.
Download LInk for mysql-connector.jar : https://goo.gl/ftjWmK

code of this video
—————————–
Class.forName(“com.mysql.jdbc.Driver”);
Connection conn = DriverManager.getConnection(“jdbc:mysql://localhost:3306/test”,”root”,””);
PreparedStatement ps = conn.prepareStatement(“insert into registration(firstName, lastName, gender, email, password, number) values(?,?,?,?,?,?);”);
ps.setString(1,firstName);
ps.setString(2,lastName);
ps.setString(3,gender);
ps.setString(4,email);
ps.setString(5,password);
ps.setString(6,number);
int x = ps.executeUpdate();
———————————————————–
Angle brackets are not allowed that is the reason I have pasted only try block code here
———————————————————–

How to Create a HTML Registration Form using bootstrap
https://www.youtube.com/watch?v=2JvaoEhgbgE

This video I have maded into two parts
1. First part I have created HTML Registration Form using Bootstrap.css
2. How to connect HTML Form with #MySQL database using #JSP

The First thing we have to do is to create a folder structure. The folder structure for JSP and servlet is same
–ROOT
—-src
—-WEB-INF
——classes
——lib
Inside the root folder minimum WEB-INF folder should be there and inside WEB-INF minimum one folder should be there which is lib
lib – folder is required for external library file in this video we need connector library.
once done then we can create html and jsp file inside the root folder

In this example we are using MySql as the database. So we need to know following informations for the mysql database:

Driver class: The driver class for the mysql database is com.mysql.jdbc.Driver.
Connection URL: The connection URL for the mysql database is jdbc:mysql://localhost:3306/test where jdbc is the API, mysql is the database, localhost is the server name on which mysql is running, we may also use IP address, 3306 is the port number and test is the database name. We may use any database, in such case, you need to replace the test with your database name.
Username: The default username for the mysql database is root.
Password: The default password for the mysql database is “”(blank).Password is given by the user at the time of installing the mysql database. In this example, we are going to use “” as the password.
Let’s first create a table in the mysql database, but before creating table, we need to create database first.

create database test;

Exit mobile version