0% found this document useful (0 votes)
53 views

Ch3 Java Database Connectivity

Java Database Connectivity (JDBC) allows Java programs to communicate with databases and manipulate data. A JDBC driver enables connection between Java applications and a database management system like Oracle, SQL Server, or MySQL. Relational databases store data in tables that can be queried using SQL. NetBeans IDE can be used to connect to a SQL Server database using JDBC and perform basic SQL operations like SELECT, INSERT, UPDATE, and DELETE statements.

Uploaded by

Omar Mohamed
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Ch3 Java Database Connectivity

Java Database Connectivity (JDBC) allows Java programs to communicate with databases and manipulate data. A JDBC driver enables connection between Java applications and a database management system like Oracle, SQL Server, or MySQL. Relational databases store data in tables that can be queried using SQL. NetBeans IDE can be used to connect to a SQL Server database using JDBC and perform basic SQL operations like SELECT, INSERT, UPDATE, and DELETE statements.

Uploaded by

Omar Mohamed
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Java Database Connectivity

Introduction
A database is an organized collection of data. There are many
different strategies for organizing data to facilitate easy access
and manipulation. A database management system
(DBMS) provides mechanisms for storing, organizing,
retrieving and modifying data for many users. Database
management systems allow for the access and storage of data
with out concern for the internal representation of data.
Today’s most popular database systems are relational
databases. A language called SQL—pronounced “sequel,” or as
its individual letters—is the international standard language
used almost universally with relational databases to perform
queries
2
Cont..
Some popular relational database management systems
(RDBMSs) are Microsoft SQL Server, Oracle, Sybase, IBM
DB2, Informix, PostgreSQL and MySQL. The JDK now comes
with a pure-Java RDBMS called Java DB.
Java programs communicate with databases and manipulate
their data using the Java Database Connectivity (JDBC)
API. A JDBC driver enables Java applications to connect to
a database in a particular DBMS and allows you to
manipulate that database using the JDBC API.
Relational Databases
A relational database is a logical representation of data
that allows the data to be accessed without consideration of
its physical structure. A relational database stores data in
tables.
Different users of a database are often interested in different
data and different relationships among the data. Most users
require only subsets of the rows and columns. Queries
specify which subsets of the data to select from a table. You
use SQL to define queries.
SQL
We now overview SQL in the context of our examples of
database. You’ll be able to use the SQL discussed here in the
examples later in the chapter.
The next several subsections discuss the SQL keywords
listed in the following Figure in the context of SQL queries
and statements. Other SQL keywords are beyond this text’s
scope. To learn other keywords, refer to the SQL reference
guide supplied by the vendor of the RDBMS you’re using.
Cont…
Accessing SQL Server on NetBeans using JDBC
This part will show you how to use NetBeans to connect SQL
Server 2012 by using Microsoft SQL Server JDBC Driver.
I’ll divide into 3 parts:
Part I : Create a connection
This part which you’re reading shows about how to establish
a connection between NetBeans and SQL Server. In this
example, I use SQL Server 2012 and NetBeans IDE 8.2
Part II : Perform SQL Operations
This part show how to perform some basic operations from
NetBeans with SQL Server. For instance, send queries as
SELECT, INSERT, UPDATE to the database.
Part III: Troubleshooting
The last part is about problems and how to fix them.
Cont…
STEP-BY-STEP GUIDES
1.Installation
Install NetBeans.
Download Microsoft SQL Server 2005 JDBC Driver, name
‘sqljdbc_1.1.1501.101_enu.exe’.
2.Add JDBC Driver to the project on NetBeans. (Add a library)
3.Connect to the database
Cont…
INSERT Statement
The INSERT statement inserts a row into a table. The
basic form of this statement is
INSERTINTO tableName( columnName1, columnName2, …,
column NameN)
VALUES( value1, value2, …, valueN)
UPDATE Statement
An UPDATE statement modifies data in a table. Its basic
form is
UPDATE tableName
SET columnName1= value1, columnName2= value2,…,
column NameN= valueN
WHERE criteria
Cont…
DELETE Statement
A SQLDELETE statement removes rows from a table. Its
basic form is
DELETEFROM tableName WHERE criteria
where tableName is the table from which to delete. The
optional WHERE clause specifies the criteria used to
determine which rows to delete. If this clause is omitted,
all the table’s rows are deleted.
Thanks

You might also like