From 65d1183ead82e2f6dbd76943688f4a11eee55563 Mon Sep 17 00:00:00 2001 From: Kanchan Rawat Date: Mon, 12 Oct 2026 14:36:02 -0400 Subject: [PATCH 1/2] Add files via upload --- pom.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 1b0d4ad..72835a2 100644 --- a/pom.xml +++ b/pom.xml @@ -18,9 +18,11 @@ provided - mysql - mysql-connector-java - 5.1.30 + com.mysql + mysql-connector-j + 8.4.0 + + provided junit From 26beea60205f699706fc119249dbe81ff8748043 Mon Sep 17 00:00:00 2001 From: Kanchan Rawat Date: Mon, 12 Oct 2026 14:40:20 -0400 Subject: [PATCH 2/2] Add files via upload --- src/main/webapp/login.jsp | 6 ++++-- src/main/webapp/userRegistration.jsp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/webapp/login.jsp b/src/main/webapp/login.jsp index 8f4a4ba..60aa483 100644 --- a/src/main/webapp/login.jsp +++ b/src/main/webapp/login.jsp @@ -2,8 +2,10 @@ <% String userName = request.getParameter("userName"); String password = request.getParameter("password"); - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection("jdbc:mysql://mydb.c1g5t3oofrok.us-west-2.rds.amazonaws.com:3306/jwt","ravi", "Admin123*"); + // DB settings come from Tomcat's environment (written to setenv.sh when the instance boots) + String dbUrl = "jdbc:mysql://" + System.getenv("DB_HOST") + ":" + System.getenv("DB_PORT") + "/" + System.getenv("DB_NAME"); + Class.forName("com.mysql.cj.jdbc.Driver"); + Connection con = DriverManager.getConnection(dbUrl, System.getenv("DB_USER"), System.getenv("DB_PASS")); Statement st = con.createStatement(); ResultSet rs; rs = st.executeQuery("select * from USER where userName='" +userName + "' and password='" +password + "'"); diff --git a/src/main/webapp/userRegistration.jsp b/src/main/webapp/userRegistration.jsp index 4c9142c..aad5cb2 100644 --- a/src/main/webapp/userRegistration.jsp +++ b/src/main/webapp/userRegistration.jsp @@ -5,8 +5,10 @@ String firstName = request.getParameter("firstName"); String lastName = request.getParameter("lastName"); String email = request.getParameter("email"); - Class.forName("com.mysql.jdbc.Driver"); - Connection con = DriverManager.getConnection("jdbc:mysql://mydb.c1g5t3oofrok.us-west-2.rds.amazonaws.com:3306/jwt", "ravi", "Admin123*"); + // DB settings come from Tomcat's environment (written to setenv.sh when the instance boots) + String dbUrl = "jdbc:mysql://" + System.getenv("DB_HOST") + ":" + System.getenv("DB_PORT") + "/" + System.getenv("DB_NAME"); + Class.forName("com.mysql.cj.jdbc.Driver"); + Connection con = DriverManager.getConnection(dbUrl, System.getenv("DB_USER"), System.getenv("DB_PASS")); Statement st = con.createStatement(); int i = st.executeUpdate("insert into USER(first_name, last_name, email, username, password, regdate) values ('" + firstName + "','" + lastName + "','" + email + "','" + userName + "','" + password + "', CURDATE())");