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 8040873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:02:09+00:00 2026-06-05T04:02:09+00:00

I am currently trying to implement a jdbc connection that returns all the data

  • 0

I am currently trying to implement a jdbc connection that returns all the data in a table when i “search” for anything that matches the input with ‘%input%’.

eg ResultSet rs4 = stm4.executeQuery("select imageTime from image_data where imageName like '%" + value3 + "%' or imageTime like '%" + value3 + "%' or imageLocation like '" + value3 + "'" );

i am trying to return ALL the rows in the result set as search results.
but if i have Resultset.next commanded when there is no more rows to go to it
causes the following results sets to all null,….

if anything id love a method to output the entire result set, thanks.

EDIT
editing the question: to be more direct; i need a way to get every piece of data from each row in each containing column of the result set. so i can output it.
This is my attempt of this below.

rs4 = a Resultset as declared below.

here is my code;

if(name_time_location == 1)
        {                
            String value3=searchInput.getText();//Sets the search Input as value3


            // selecting the cominbation from table, that match input options                               
            try{
                con = DriverManager.getConnection("jdbc:mysql:blah blah");

                // Query the database for the correct username and passord                    
                Statement stm3 = con.createStatement();  
                Statement stm4 = con.createStatement();
                Statement stm5 = con.createStatement();


                //queries database for password from input username 
                ResultSet rs3 = stm3.executeQuery("select imageName from image_data    where imageName like '%" + value3 + "%' or imageTime like '%" + value3 + "%' or imageLocation like '" + value3 + "'" );
                //ResultSetMetaData rsmd = rs3.getMetaData();
                //stm3.setFetchSize(5);
                //rs3.last();
                //int numberOfRows = rs3.getRow();


                //String[] resultList; 
                //resultList = new String[numberOfRows];
                // Fetch each row from the result set
                rs3.beforeFirst();
                while(rs3.next())
                {
                    imageSearchResult1 = rs3.getString(1); 
                    rs3.next();
                    imageSearchResult11 = rs4.getString(1);
                    rs3.next();
                    imageSearchResult12 = rs4.getString(1);
                    rs3.next();
                    imageSearchResult13 = rs4.getString(1);
                    rs3.next();
                    imageSearchResult14 = rs4.getString(1); 
                }rs3.close();

            }catch (Exception e)
            {
                    //System.out.println("Exception: " + e + "");
            }

            System.out.println("Search Results: \nName: " + imageSearchResult1 + "         Time stamp: " + imageSearchResult2 + "   Location: " + imageSearchResult3 + "\n" +
                    "Name: " + imageSearchResult11 + "   Time stamp: " + imageSearchResult21 + "   Location: " + imageSearchResult31 + "\n" + 
                    "Name: " + imageSearchResult12 + "   Time stamp: " + imageSearchResult22 + "   Location: " + imageSearchResult32 + "\n" +
                    "Name: " + imageSearchResult13 + "   Time stamp: " + imageSearchResult23 + "   Location: " + imageSearchResult33 + "\n" +
                    "Name: " + imageSearchResult14 + "   Time stamp: " + imageSearchResult24 + "   Location: " + imageSearchResult34 + "\n" );
  • 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-05T04:02:11+00:00Added an answer on June 5, 2026 at 4:02 am

    I think you can achieve the same thing by modifying the query and instead of creating 3 queries, get the 3 values in the same query as:

    select imageName,imageLocation,imageTime from .....
    

    Then use this query to generate the ResultSet and get the three values as rs.getType(1),rs.getType(2),rs.getType(3).

    In the same while(rs.next()) loop, you can print the data that you want to print.

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

Sidebar

Related Questions

I'm currently trying to implement a Table View on my iPhone app that grabs
I'm currently trying to implement a UITableView with a delegate and data source that
I am currently trying implement a QThread that contains a socket connection. The socket
I'm currently trying to implement a socket server that enables the clients to send
I'm currently trying to implement a feature in my app that shows tags for
I'm currently trying to implement something that combines reverse engineering and graph theory. Therefore
Hey guys, I'm currently trying to implement a function using C that takes in
All I am currently trying implement something along the lines of dim l_stuff as
I'm currently trying to implement a Search in my App. I followed Google's Tutorial
I'm currently trying to implement an ExtendedListView that uses an Adapter. I'm implementing the

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.