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

  • Home
  • SEARCH
  • 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 7896233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:50:29+00:00 2026-06-03T07:50:29+00:00

<%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%> <%@page import=java.sql.*%><%@page import = java.sql.ResultSet %> <%@page import

  • 0
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="java.sql.*"%><%@page import = "java.sql.ResultSet"  %>
<%@page import = "java.sql.Connection"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Getting Database Connection</title>
</head>
<body>
    <%
     ResultSet result = null ;
   Connection connection1 = null;
  try
  {
      String driverName1 = "oracle.jdbc.driver.OracleDriver";
      Class.forName(driverName1);
      String serverName = "localhost";
      String portNumber = "1521";
      String sid = "XE";
      String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
      String username = "SYSTEM";
      String password = "password";
      connection1 = DriverManager.getConnection(url, username, password);
      out.println(connection1.isClosed());


      String Name = request.getParameter("name");
      String Age = request.getParameter("age");
       int AgeConvert = Integer.parseInt(Age); 
       String ADR = request.getParameter("address");
       String sqlInsert =  " INSERT INTO ADDRESS  (NAME,AGE,ADR)  VALUES ('" + Name + "' , " + AgeConvert + ", '" + ADR +"')";

       Statement stm = connection1.createStatement();
       stm.execute(sqlInsert);
       out.println(" User Created");

  }

catch(Exception e )
{
    out.println("User not created");
    e.printStackTrace();

}
%>
 <table>
  <tr>
  <td> <b>To search the User Please enter the name in the below box </b> </td>
  </tr>
  <tr>
  <td> Name </td>
  <td> <input type = "text" name ="userName" /> </td>
  </tr>
  <tr>
   <td> <input type ="submit" value = "Search" /></td>
   </tr>
  </table>

<%    ResultSet results = null ;
     String userNameToBeSearched = request.getParameter("userName");
     String sqlselect =  " SELECT * FROM ADDRESS WHERE NAME ='"+userNameToBeSearched+"'";
     Statement stm2 = connection1.createStatement();
     results = stm2.execute(sqlselect);
    **// getting error in this loop it says can convert boolean to ResultSet please help me**
     if (results.next()) {  

    do {  

        %>
        <TABLE BORDER="1">
            <TR>
               <TH>Name</TH>
               <TH>Age</TH>
               <TH>Address</TH>
            </TR>
           <TR>
               <TD> <%= results.getString(1) %> </TD>
               <TD> <%= results.getInt(2) %> </TD>
               <TD> <%= results.getString(3) %> </TD>


          </TR>
       </TABLE>

     <%     
      } while (results.next());  

     } else 

        {  
    out.println("User not found");
 }  
     %>

        </body>
</html>
  • 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-03T07:50:30+00:00Added an answer on June 3, 2026 at 7:50 am
     if(!resultSet.isBeforeFirst()){
       System.out.println("resultset contin no rows");
     }
    

    isBeforeFirst() returns true if the cursor is before the first row; false if the cursor is at any other position or the result set contains no rows

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

Sidebar

Related Questions

Remote.jsp code: <%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%> <!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01
I have the following jsp file <%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%> <%@ page
I've created the following JSP: <!-- WebContent/pages/ResourceBundlesJST.jsp --> <%@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1%>
I have jsp file: <%@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8%> <%@ taglib prefix=c uri=http://java.sun.com/jsp/jstl/core%>
I'm having trouble with UTF-8. common.jsp <%@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8%> typical.jsp <%@
I can't solve this problem can you help me please. <%@ page language=java contentType=text/html;
I have some text in a non-English/foreign language in my page, but when I
What is the difference and relation between Page description language , markup language and
I have some script in my default page that redirects users to language specific
How does Google Toolbar determine the language of a page to offer translation from

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.