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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:52:07+00:00 2026-06-04T19:52:07+00:00

I was just wondering that why would the driver manager class provides many overloaded

  • 0

I was just wondering that why would the driver manager class provides many overloaded
methods to get connection to the database. Some of them are

getConnection(String url, String user, String password) 
getConnection(String url, Properties info)

The others can be found at http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/DriverManager.html

You need to have the same set of information before hand you get a connection to database
in each case but each of the getConnection() methods has a different way to access that information. I have seen people using all of them without any preference for a particular(as far as I feel).

My question is that is there any preference in terms of coding style because of which use of one may be preferred over other. If not isn’t this overloading redundant?

  • 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-04T19:52:09+00:00Added an answer on June 4, 2026 at 7:52 pm

    Technically the getConnection(String url, Properties info) one is much cleaner if you programmatically collect the driver properties. The original thought was that people would configure a driver using a GUI, using the getPropertyInfo method of the Driver interface to collect all possible properties for selection and configuration in the GUI.

    You then simply needed to store the (base) JDBC url and a .properties file with all driver properties (or a (serialized) copy of the properties object) to make connections. I am not sure if anybody ever used it in that way.

    So the original idea never really caught on (AFAIK), and people preferred storing JDBC urls with all properties as part of the URL and having username and password seperately, thus using getConnection(String url, String user, String password) or maybe even getConnection(String url) by including the username and password in the URL.

    With the introduction of DataSource in JDBC 2 (standard extension) I believe there was even talk about deprecating and ultimately removing DriverManager in favor of always using DataSources (as they used the JavaBeans style of configuration); although that actually never happened.

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

Sidebar

Related Questions

Just wondering what is the best practice way of creating a class that needs
Was just wondering how do these sites (and many other softwares that generate flash
I'm just wondering what kind of SQL command I could execute that would select
Hey I was just wondering if there is a cool one liner that would
Just wondering if there's a website out there that allows you to hotlink to
Just wondering if there is any benchmark software that I can download that will
Just wondering how to set a hidden field value so that when I submit
i just wondering is there any performance issue or anything thing wrong if that
I was just wondering if a storage engine type existed that allowed you to
I'm just wondering if it's possible to validate or check that at least one

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.