Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@ecneha-1fBp2t • Apr 14, 2010
I was in lil bit hurry...so I created a new thread....
sorry for that.. -
@sookie-T06sFW • Apr 15, 2010
Hi ecneha,
Just check this out if can solve your problem - <a href="https://www.roseindia.net/mysql/mysqldatabase.shtml" target="_blank" rel="nofollow noopener noreferrer">Connecting to MySQL database and retrieving and displaying data in JSPpage</a>. 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-bnL4Ck • Oct 26, 2018
Hi,
Here I am listing a few code but You can get the complete code from <a href="https://hackr.io/tutorials/learn-sql" target="_blank" rel="nofollow noopener noreferrer">Learn SQL - [2023] Best SQL Tutorials | Hackr.io</a>
<%@ 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
 %>