JDBC Programming
JDBC Programming
com/Gctpak
We can use JDBC API to access tabular data stored in any relational database.
By the help of JDBC API, we can save, update, delete and fetch data from the
database. It is like Open Database Connectivity (ODBC) provided by Microsoft.
The current version of JDBC is 4.3. It is the stable release since 21st
September, 2017. Sun Microsystems released JDBC as part of Java
Development Kit (JDK)
What is API?
API (Application programming interface) is a document that contains a
description of all the features of a product or software. It represents classes and
interfaces that software programs can follow to communicate with each other.
An API can be created for applications, libraries, operating systems, etc.
www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab
Installing the JDBC Driver for MySQL
www.SalmanAdeeb.wixsite.com/DAE-CIT-books Databases www.facebook.com/Gctpak
To install the JDBC driver for MySQL databases, complete the following steps.
1. Download the latest version of Connector/J for your platform
from https://dev.mysql.com/downloads/connector/j/ and install it.
2. Locate the mysql-connector-java-<version>-bin.jar file among the files
that were installed.
For example, on Windows: C:\Program Files (x86)\MySQL\MySQL
Connector J\mysql-connector-java-5.1.30-bin.jar.
3. Rename the file to mysql-connector.jar.
4. Copy the file to <ECloud install>/<arch>/lib/.
o On Linux, the default location is /opt/ecloud/i686_Linux/lib/.
o On Windows, the default location is C:\ECloud\i686_win32\lib\.
8.3.Accessing a Database:
The process of retrieving information from a database via JDBC involves these
five basic steps:
1. Register the JDBC driver with the driver manager.
2. Establish a database connection.
3. Execute an SQL statement.
4. Process the results.
5. Close the database connection
www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab
www.SalmanAdeeb.wixsite.com/DAE-CIT-books www.facebook.com/Gctpak
www.youtube.com/AdeebTechnologyLab www.facebook.com/Adeeb.Technology.Lab