Trail: JDBC(TM) Database Access
Lesson: JDBC Basics
Getting Started
Home Page > JDBC(TM) Database Access > JDBC Basics
Getting Started

This lesson helps you to set up a JDBC™ development environment. This includes the following steps:

  1. Install the latest version of the Java™ platform on your machine. If you don't already have a database, it is recommended that you download the latest version of the NetBeans™ IDE and the Sun Application Server, which comes with Java DB.
    • To install the Java platform, follow the instructions after downloading Java platform software and NetBeans. These downloads provide you with the JDBC package. JDBC includes the java.sql and javax.sql packages, which has the necessary interfaces and classes you'll need for developing JDBC applications.

      You can find the latest release at the following URL:

      
      http://java.sun.com/products/JDK/CurrentRelease
      
  2. Install a driver on your machine.
    • You also need to install a driver on your machine. If you installed NetBeans with the Sun Application Server, then you have the driver that you need.


      Note: A JDBC driver can come from many sources: database software, such as Java DB, a JDBC driver vendor such as DataDirect, Oracle, MySQL, or an ISV/OEM such as Sun. Your driver should include instructions for installing it. For a JDBC driver written for specific Database Management Systems (DBMS), installation consists of copying the driver onto your machine. No special configuration is needed.


  3. Install your Database Management System (DBMS) if needed.
    • If you do not already have a Database Management System (DBMS) installed, follow the vendor's instructions for installation. You can download the Java DB database, which comes bundled with the Sun Application Server:
      Free Trial Download, and the NetBeans IDE. as well.

      Types of Drivers

      There are many possible implementations of JDBC drivers. These implementations are categorized as follows:

      • Type 1 - drivers that implement the JDBC API as a mapping to another data access API, such as ODBC. Drivers of this type are generally dependent on a native library, which limits their portability. The JDBC-ODBC Bridge driver is an example of a Type 1 driver.

      • Type 2 - drivers that are written partly in the Java programming language and partly in native code. These drivers use a native client library specific to the data source to which they connect. Again, because of the native code, their portability is limited.

      • Type 3 - drivers that use a pure Java client and communicate with a middleware server using a database-independent protocol. The middleware server then communicates the client?s requests to the data source.

      • Type 4 - drivers that are pure Java and implement the network protocol for a specific data source. The client connects directly to the data source.

      Check which driver type comes with your DBMS on the JDBC Data Access API Drivers page. Java DB ships with two Type 4 drivers, an Embedded driver and a Network Client Driver.

Previous page: JDBC Basics
Next page: Setting Up a Database