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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:05:13+00:00 2026-05-24T01:05:13+00:00

I got a Swing app that start asking the user for the connection parameters,

  • 0

I got a Swing app that start asking the user for the connection parameters, as every user can make mistakes I want to know the best way to handle when they make a wrong connection attempt i.e wrong url

what I got is a button that sends dbType, user, pass and url to a Map and then I obtain an EntityManagerFactory that last the whole application like this:

emf = Persistence.createEntityManagerFactory("persistenceUnit", connectionProperties);

however is taking almost 1 min in telling me

java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection

  • Can I manipulate Hibernate to answer timeout faster?
  • Should I change the way I’m using the entityManagerFactory?

EDIT: I have a Connector class that all it does is allow the GUI to send the parameters to it and then allows my DAO to retrieve an instance of that class to obtain the EntityManagerFactory. These are all my connection properties, the GUI changes the dialect based on the DB it picks.:

connectionProperties.put("hibernate.dialect", "org.hibernate.dialect.Oracle10gDialect"); connectionProperties.put("hibernate.connection.driver_class", "oracle.jdbc.driver.OracleDriver");
connectionProperties.put("hibernate.connection.url", userSettings.get("url", ""));
connectionProperties.put("hibernate.connection.username", userSettings.get("username", ""));
connectionProperties.put("hibernate.connection.password", userSettings.get("password", ""));

and this is the method that provides an EntityManager to whoever needs one:

protected EntityManager getEntityManager() {
if (em == null) {
em = Connector.getInstance().getEmf().createEntityManager();
return em;
} else {
return em;
}
}

  • 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-05-24T01:05:13+00:00Added an answer on May 24, 2026 at 1:05 am

    I have to say I’m surprised that it appears the only way to set a JDBC connection timeout is with the static DriverManager.setLoginTimeout(). I expected to find some timeout support in the popular connection pools, but it seems not to exist except in C3P0’s non-pooling DataSource implementation, which you wouldn’t want to use for a production app.

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

Sidebar

Related Questions

I'm currently working on a Swing app and I've got a few JTextAreas that
i've got a few questions about applets in java. Let's say that my app
I've got a problem, that swing components in different parts of program have sometimes
So I've got a JPanel implementing MouseListener and MouseMotionListener : import javax.swing.*; import java.awt.*;
Got a class that serializes into xml with XMLEncoder nicely with all the variables
Got a problem with ADOMD.NET 8.0, SQL2008 and our app. It isn't giving us
I've got an application here that I wrote many years ago that consists of
Got an application (C# WPF) that needs to call home and get updated stuff
I've got a Swing application with a model and a view. In the view
I've got a (primarily) single threaded application which updates a swing chart component (jfreechart)

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.