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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:40:18+00:00 2026-06-02T22:40:18+00:00

In JDBC, to connect and execute statements in DB we mainly make use of

  • 0

In JDBC, to connect and execute statements in DB we mainly make use of Connection,Statement and ResultSet which are interfaces. But their corresponding objects is later used to run methods like createStatement(),executeQuery(),next() etc.Which class implements these methods?
Why it is called as connection object instead of implemented class object?

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

    In JDBC you first register a driver by calling

    Class.forName('classname')
    

    which loads the Database class and registers that class with DriverManager

    When you say DriverManager.getConnection() – It returns you java.sql.Connection (the contract as per specification)

    Which class implements these methods?

    The actual implementation is provided by the database vendor, for e.g. Oracle, MySQL.

    Why it is called as connection object instead of implemented class
    object?

    Because you code to Interface and not implementation (good coding practice).

    If you want you can look up in the vendor jar and find which class implements Connection then instead of

    Connection connection = DriverManager.getConnection()
    

    you can write

    VendorConnectionImpl vendorConnection = (VendorConnectionImpl)DriverManager.getConnection()
    

    This above will work but then it will bind you with that specific implementation.

    If you want to move from vendor1 to vendor2 you cannot do that, first you will have to change the above code as per vendor2 API, But if you use the first approach you can move from Vendor to Vendor without having pain of changing your code.

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

Sidebar

Related Questions

Can anyone please tell me to use which jdbc driver to connect with oracle
java.sql.SQLException: Network error IOException: Connection timed out: connect at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:410) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
I use JBossAS5 and JDBC to connect database and want to log all JDBC
In (say) Python, I can issue: psycopg2.connect(...).cursor().execute(select * from account where id='00100000006ONCrAAO') which on
I am using JDBC to connect to a MySQL server (no connection pooling I
I am new to Java and I am attempting to use JDBC to connect
I'm trying to connect Java and MySQL with JDBC connector. So, I've downloaded connector
How to connect to a Microsoft Access-based database in a Windows using JDBC code?
Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection I
Where should an JDBC-compliant application store its SQL statements and why? So far, I

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.