Getting Started with JDBC
By: Priya Mani
This tutorial helps you to set up a JDBCâ„¢ development environment. This includes the following steps:
- 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
andjavax.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
- 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.
- Install your Database Management System (DBMS) if needed.
- 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.
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:
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.
- 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.
Archived Comments
1. Dorothynob
View Tutorial By: Dorothynob at 2017-01-30 16:51:18
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
TEXT datatype SPLIT in MSSQL - to solve the 8000 limit set by varchar
What is Referential Integrity in databases?
Handling CSV in Stored Procedures
java.lang.NoClassDefFoundError and java.lang.NoSuchMethodError
Calling a Stored Procedure from JDBC in Java
setSavepoint and releaseSavepoint Example in Java
PreparedStatement Example in Java
Creating Database Tables Using ANT
Using the DriverManager Class vs Using a DataSource Object for a connection
Stored Procedures example in SQL