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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:15:12+00:00 2026-05-27T07:15:12+00:00

I am connecting to a DB2 server using the following code: try { Class.forName(com.ibm.db2.jcc.DB2Driver);

  • 0

I am connecting to a DB2 server using the following code:

try {
     Class.forName("com.ibm.db2.jcc.DB2Driver");
} catch (ClassNotFoundException cnfe) {
     cnfe.printStackTrace();
}

try {
     con = DriverManager.getConnection("jdbc:db2://IP:port/db name", "username", "password");
} catch (SQLException sqle) {
     sqle.printStackTrace();
}

If the connection is not established, what is the best way to handle this situation?

  • 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-27T07:15:13+00:00Added an answer on May 27, 2026 at 7:15 am

    If you’re asking whether you should try to re-connect or not – you most probably don’t want to implement that logic yourself, take some connection pooling library like C3P0 or DBCP.

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

Sidebar

Related Questions

I create a custom schema in my DB2 database using the following command: db2
In connection with data replication from SQL Server to DB2 I have the following
When connecting to sql server, I have the hardcoded string (local). Is this a
I have someone connecting to my repository using the url (substituted the IP address):
I m executing following: db2 -tvsf ./sql/update_product.sql I have used eclipse for editing update_product.sql
I would like to connect to a DB2 database, specifically an iSeries version, using
I have a simple Java app that suddenly stopped connecting to a local DB2
I am using command db2 restore db S18 from /users/intadm/s18backup/ taken at 20110913113341 on
I have to make DB2 connection in java using port number. Is there any
I have the following snippet in a bash script: db2 connect to $DB var=$(db2

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.