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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:11:18+00:00 2026-05-26T05:11:18+00:00

I have a Java library where I access the DB via JDBC using Spring’s

  • 0

I have a Java library where I access the DB via JDBC using Spring’s JDBC support. This library contains approximately a DAO class for each table I need to access, which are over a hundred. Currently I instantiate a new JdbcTemplate, or one of its variants, each time I need to perform a new query. Is this considered good practice or should I reuse a single JdbcTemplate as much as I can? I’ve actually seen examples of both approaches in either books or online documentation.

The context is a J2EE application, but ideally the code should be usable in different contexts, e.g. in offline tests or command line support tools.

  • 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-26T05:11:19+00:00Added an answer on May 26, 2026 at 5:11 am

    Inject one, why bother instantiating? (It’s unclear if you mean “instantiate through the Spring context” or “instantiate using new“.)

    Most samples I’ve seen do this in the config, I’m not even sure I’ve seen them instantiated manually outside of demo/test code. I see little benefit to doing it manualy, and zero if done outside of Spring.

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

Sidebar

Related Questions

I have a java library that I am accessing in VB.NET via COM. The
I have working code using the spring-ws library to respond to soap requests. I
I have an external java library I am using in my Grails project. It
Does Java have (or is there a library available) that allows me to have
I have a problem with a specific java client library. Here is the situation:
I find it funny that Java (or the java.util library) does not have a
I have an existing library (JPhysX) that is a Java wrapper for a native
I'm writing a Qt based (QtCore) C++ library and would like to have access
I have written a library in C using a variety of the #pragma omp
I have created a jar file to load a native library ( using System.loadlibrary()

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.