Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8166311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:49:13+00:00 2026-06-06T19:49:13+00:00

I have made a registration table reg1 and stored the values for every registered

  • 0

I have made a registration table reg1 and stored the values for every registered users from a HTML file. Now I have made a Log-In page in HTML where users can give their username and see the datas entered by them. I have made an user “bbb” and want to show his username only.So I made the general java code like follows:

    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;

    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    public class Check extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         // TODO Auto-generated method stub
         String username=request.getParameter("username");
         try{
             Class.forName("oracle.jdbc.driver.OracleDriver");
             String url="jdbc:oracle:thin:@localhost:1521:XE";
             Connection con=DriverManager.getConnection(url,"system","root");
             Statement stmt=con.createStatement();
             ResultSet rs=stmt.executeQuery("select uname from reg1");


            while(rs.next())    
                {

                String name=rs.getString("uname");
                if(name==username)
                {


                response.setContentType("text/html");
                PrintWriter pw=response.getWriter();
                pw.println("Your User name is:"+username);

            //  System.out.println(""+name);
                }



                    con.commit();

                }
             stmt.close();
    }


                catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (ClassNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }


    }

   }

It is giving errors like java.sql.SQLException: Closed Statement: next

The table is like follows:

FNAME LNAME ADDR MAIL OCCU UNAME PASSWD
aaa aaa aaaa aaa aaaa bbb cccc
bkgkb jjv jhvjmh jjkg jvjv jvjvh bjbmb

Please help me resolving this!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:49:14+00:00Added an answer on June 6, 2026 at 7:49 pm

    Try removing the con.commit line, there is no need for that.

    You should add finally to your catch and close the statement there.

    And you should also use PreparedStatement instead of Statement.

    About finally see here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

users table In the Registration time every user have to put parent_id , who
I have made user registration which includes (name, password, email, phone no) and now
I have made a registration program. Making use of mysql database. Can I still
I have a registration form on my layout grid, made out of a stackPanel.
i have made an application having entity framewrok. It is wpf application, now it
I have made a code that read data from flash Nand (without filesystem). fd
I have made a user registration where I have salted the user password and
I have made customized user registration page. and i have made that on theme
I have made a form for client registration, and I can't make this postvalidators
i have made user-register.tpl.php file. And i have set many text field in that.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.