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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:43:35+00:00 2026-05-30T21:43:35+00:00

I read about Drivers that uses JDBC API in a book. Not clear about

  • 0

I read about Drivers that uses JDBC API in a book. Not clear about the explanation. I want to know what type of driver does the below code uses. Is it type 4 driver( java driver provided by the database vendor). It was mentioned nothing needs to be installed in the client application for type 4 drivers. But still we need to have the class file com.mysql.jdbc.Driver for the code to work. Not sure what is meant here.

Also it was mentioned type 2 drives use the binary code of the driver by the database vendor and it needs to be installed in the client. How it differs from the below example. Would be helpful if a sample code can be pasted for accessing type 2 drivers.

Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost/coffeebreak";
conn = DriverManager.getConnection(url, "username", "password");
doTests();
conn.close();
  • 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-30T21:43:36+00:00Added an answer on May 30, 2026 at 9:43 pm

    When you see the phrase “nothing needs to be installed” in reference to type 4 JDBC drivers (especially in old documentation), it refers to the fact that nothing besides the driver jar itself needs to be installed on the client machine. You will need the driver jar no matter what, but with the other types:

    • Type 1: ODBC and an ODBC driver will need to be installed on the client system
    • Type 2: a native database driver will need to be installed on the client system
    • Type 3: a protocol proxy server will need to be installed between the client system and the database

    So for example, an Oracle type 2 driver (in addition to the jdbc jar itself), requires a complete oracle client installation on the machine that will run the java code.

    A couple of notes:

    • Since java 6 (IIRC), with a modern jdbc driver, you don’t need the Class.forName statement any more. Newer JDBC drivers now register themselves automatically.

    • You can’t tell just by looking at the code that uses it (that’s the whole point), but the mysql jdbc driver is a type 4 driver.

    • As you can’t tell the difference by using the driver, the sample code to use a type 2 driver is the same as what you’ve provided in the question.

    • All types of jdbc driver (type 1 excepted, as there was only 1 instance of that) feature drivers provided by the vendor. The type refers to how the driver connects to the database, not who provides it.

    • Type 2 drivers are pretty rare these days, and IMO, nobody really uses type 1 or 3 drivers anymore at all.

    • These days, almost all modern, production-worthy jdbc drivers are type 4. (I know that oracle provides both a type 2 and a type 4 driver, but that’s the only one I can think of, and the two drivers have the same features.) Use type 4 unless you have some highly specific advice from the database vendor.

    Also, the language you are quoting sounds pretty dated. The basics of JDBC haven’t significantly changed in a while, but even so you might want to check out a newer book.

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

Sidebar

Related Questions

I'm not interested in a hardware solution, I want to know about software that
Read about Server push here . I want to push data to client from
I read about using <context:component-scan base-package=tld.mydomain.business> <context:include-filter type=annotation expression=org.springframework.stereotype.Service/> </context:component-scan> and annotate my service
I read about an inheritance feature in PostgreSQL that seemed pretty neat. Unfortunately I
I am told that the prefered method to load the JDBC driver is :
Consider a Linux driver that uses get_user_pages (or get_page ) to map pages from
I read about the volatile keyword, but I don't know in what situations I
I read about the Conditional attribute today. According to MSDN: Applying ConditionalAttribute to a
I read about using the CASE expression inside the WHERE clause here: http://scottelkin.com/sql/using-a-case-statement-in-a-sql-where-clause/ I'm
Ive read about it and to be honest it all seems like a bunch

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.