JSP code for online hotel management system for connecting it with mysql database
can somebody provide that??
😔😕😕😕
Replies
-
ecnehaI was in lil bit hurry...so I created a new thread....
sorry for that.. -
sookieHi ecneha,
Just check this out if can solve your problem - Connecting to MySQL database and retrieving and displaying data in JSPpage. This will provide you how to make connection to your database but it can't help you in rest of the hotel management code 😀 -
Vijay Khatri
Hi,
Here I am listing a few code but You can get the complete code from Learn SQL - [2023] Best SQL Tutorials | Hackr.io
<%@ page import ="java.sql.*" %>
 <%@ page import ="javax.sql.*" %>
 <%
 String userid=request.getParameter("user");
 session.putValue("userid",userid);
 String pwd=request.getParameter("pwd");
 Class.forName("com.mysql.jdbc.Driver");
 java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/
 test","root","root");
 Statement st= con.createStatement();
 ResultSet rs=st.executeQuery("select * from users where user_id='"+userid+"'");
 if(rs.next())
 {
 if(rs.getString(2).equals(pwd))
 {
 out.println("welcome"+userid);
 }
 else
 {
 out.println("Invalid password try again");
 }
 }
 else
 %>
You are reading an archived discussion.