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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:12:21+00:00 2026-06-09T03:12:21+00:00

i have try to develop one java app.here am getting information from mysql database.

  • 0

i have try to develop one java app.here am getting information from mysql database.
my code is:

public class RetailerWs {
  public int data(){
    int count=0;
    try {
      Class.forName("com.mysql.jdbc.Driver");
      Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/pro","root","");
      PreparedStatement statement =  con.prepareStatement("select * from orders where status='Q' AND MONTH(date) = MONTH(CURDATE()) AND YEAR(date) = YEAR(CURDATE())");
      ResultSet result = statement.executeQuery();
      while(result.next()) {
        // Do something with the row returned.
        count++; //if the first col is a count.
      }
    }
    catch(Exception exc){
      System.out.println(exc.getMessage());
    }
    return count;
  }
}

the other class is :

 public class Demo {
 public static void main(String[] args){
    RetailerWs obj = new RetailerWs();
    System.out.println(obj.data());
 }

}

Here i have to check the query and display count value is successfully.but my doubt is the query matched item is zero means the output is displayed blankly.but i wish to need it is display 0.not display blank screen..so please help me how is to do.

  • 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-09T03:12:23+00:00Added an answer on June 9, 2026 at 3:12 am

    Create the object of class RetailerWs.

    RetailerWs  obj =new RetailerWs ();
    System.out.println(obj.data());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm try develop an ActiveX Control in VB6. It have one UserControl and one
I have two Macs that I develop from, one an iMac and one a
I have try to set icon for my App in the xCode. In the
Here is example which I have try <?php include 'spider/classes/simple_html_dom.php'; $html = new simple_html_dom();
I have a Try Catch in my code. I would like to know if
Is it considered bad practice to have multiple try's in one method and structure
As I'm just starting to develop an iPad application & have started getting used
I have been challenged by a professor to develop a little Bluetooth Demo app
I have develop one application in which 3 activity. in first activity there are
Folks, I have one application to develop in which I need notification when 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.