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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:54:58+00:00 2026-06-16T02:54:58+00:00

Good day. I have coded a server application that handles many socket connections from

  • 0

Good day. I have coded a server application that handles many socket connections from app clients, each client request to the server certain information from a sql database to display in its gui interface, calling a method inside the server to make the query and retrieve the data.

In some cases, the application hangs while tries to retrieve the data from the server, i want to my application does not freeze, but instead show a progress bar or an loading animation while retrieving the request. Is this somehow possible? I’ve read about threads, workers and sql pools, but i dont know exactly what it fits on my needs.

I have this class on server app to manage my queries:

final class QueryManager {
//abstract System.out.println("Ya");
static Connection con = null;
static String LoginMsg = "No conectado";
public static void init(){
try{
   Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
   con=DriverManager.getConnection("jdbc:sqlserver://PERSONAL:49617;databaseName=prueba","sa", "12345678");
   System.out.println("Conexión Establecida");
   LoginMsg = "Conectado al Servidor";
}catch(ClassNotFoundException | SQLException e){
    e.printStackTrace();
    System.out.println("Exception: " + e.getMessage());
}
}
 public static void Query(String query, int i){
try{
Statement st = con.createStatement();
    try (ResultSet rset = st.executeQuery(Pquery(query))) {
        rset.next();
        System.out.println(rset.getString(1)+i);
    }
}catch(SQLException e){
System.out.println(e);
}


}

public static String Pquery(String pquery){
return pquery;
}
public static boolean Login(String user, String pass){
boolean r = false;
try{
Statement getCon = con.createStatement();
ResultSet EQuery = getCon.executeQuery("select * from users where usuario ='"+user+"'      and contrasena ='"+pass+"'");
EQuery.next();       
    if(EQuery.getString(1) != null){
        r = true;  
        LoginMsg = "Bienvenido";
    }else{
        r = false;

    }
    EQuery.close();
}catch(SQLException e){
    System.out.println(e);
}
return r;

}
public static String getLoginMsg(){
return LoginMsg;
}
public static void printer(){
    System.out.println("Ya");

}
}

Thank you in advance, any help on logic also will be much appreciated.

EDIT:

I have found this example and might be usefull. Thank you for your support.

https://sites.google.com/site/drjohnbmatthews/randomdata

  • 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-16T02:54:59+00:00Added an answer on June 16, 2026 at 2:54 am

    run your client side logic of sending request and getting results from server in a separate backgroud thread. you can use SwingWorker to achive that. With the help of this you can run a progress bar for the UI while that logic is running in backgroud thread.
    For example: swing worker

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

Sidebar

Related Questions

Good day, I have created an object that will manage data access. My app
Good day, I have a ASP.net MVC app that needs to upload files to
Good day I have a custom TextBox that has a IndicatorTextBox.ui.xml file as well
Good day, I have a class that implements the LoaderCallbacks, and hence have the
Good Day, I have a simple working routine in Perl that swaps two words:
Good Day, I have a Hibernate mapping that looks something like this: public class
Good day all; I have an UIImageView that I animate around a large UIView.
Good day, Stack Overflow. I have a homework assignment that I'm working on this
Good day code knights, I have a tricky problem that I cannot see a
Good day everyone, I have an HTACCESS file that contains the following: Options +FollowSymlinks

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.