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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:40:43+00:00 2026-06-12T22:40:43+00:00

I am using JDBCTemplate. For one particular query JDBCTemplate hangs after calling more than

  • 0

I am using JDBCTemplate. For one particular query JDBCTemplate hangs after calling more than 3-4 times, sometimes after 15-20 attempts. I haven’t found any bug in my code.

private String getXXX(String table)
{
    System.out.println("Test 1");
    final List<String> data = getJdbcTemplate().queryForList(SELECT_TBL_NME,
                new Object[] { table }, String.class);
    System.out.println("Test 2");
    ret = data.size() > 0 ? data.get(0) : null;
    return ret;
}

Console hangs at “Test 1” without any error if the function is called more than 15 times or sometimes even after the 3rd or 4th call.

  • 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-12T22:40:44+00:00Added an answer on June 12, 2026 at 10:40 pm

    The problem seems to be that you aren’t closing the connections.

    final List data = getJdbcTemplate().queryForList(SELECT_TBL_NME, new Object[] { table}, String.class);
    

    The line above will never end because the JdbcTemplate is waiting to get a connection from your db.

    So if your db cannot give you a connection your application is waiting, waiting, waiting and it does nothing with the time.

    possible fix: Since you are using Spring, check that you aren’t doing operation outside your queryForList method.

    I had the same problem few months ago because I was calling the ResultSet.getMetaData() outside my queryForList method and that was’t releasing/closing the connection.

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

Sidebar

Related Questions

When using one of the various JDBC template methods I am confused on how
I'm using jdbcTemplate, and have a ResultSet consisting of about 100 named fields. And
Hi I am using spring jdbctemplate to invoke an oracle function which takes an
I'm using Spring JdbcTemplate interface for fetching data from a MS SqlServer DB. In
I am using JdbcTemplate.queryForInt to insert a Row into the DB, and then get
I have a single thread trying to connect to a database using JDBCTemplate as
We're using Spring jdbcTemplate for implementing the service layer right now but at some
We are looking into using the JdbcTemplate for accessing the DB - but we
I am using Spring and JDBCTemplate. The scenario is a CUSTOMER table and ORDERS
I'm using Apache Derby with the Spring JdbcTemplate inside a web app running on

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.