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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:14:10+00:00 2026-05-22T15:14:10+00:00

I am using JDBC to connect to a DB. Since the network was slow,

  • 0

I am using JDBC to connect to a DB. Since the network was slow, i could get the connection after some 2 or 3 retry manually. Is it possible to retry the connection automatically if connection fails? I am using SQLServer 2008 database.
Thanks

  • 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-22T15:14:11+00:00Added an answer on May 22, 2026 at 3:14 pm

    A bit decent connection pool is already configureable to do so, for example BoneCP. Most do even do it by default. If you don’t use a connection pool but just the basic DriverManager#getConnection() approach, then you have to re-execute it yourself in a while loop as long as the Connection is null.

    Here’s a basic kickoff example:

    Connection connection = null;
    
    while (connection == null) {
        try {
            connection = DriverManager.getConnection(url, username, password);
        } catch (SQLException e) {
            logger.info("Connecting failed, retrying...");
        }
    }
    
    return connection;
    

    This can of course be optimized more with bit longer pauses in between and by setting a maximum retry count, etcetera.

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

Sidebar

Related Questions

Is it possible to connect to an Oracle DB using a jdbc connection string
I am using JDBC to connect to my microsoft access database. I get the
I am using JDBC with proxool connection pool to connect to mysql DB. I
I am using JDBC to connect to a database server. The connection is over
Possible Duplicate: How to get the insert ID in JDBC? Hi, I'm using JDBC
I am using JDBC to connect to a MySQL server (no connection pooling I
I am using Oracle 9 JDBC Thin Driver - the connection string I have
I am using jdbc to connect to a postgresql database in a java application
I am using JDBC to connect to MySQL for a small application. In order
I'm trying to connect to a SQL Server database using JDBC, the database I'm

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.