Database Connection With Javascript
Database Connection With Javascript
Connection with
Javascript
BY
JACK JAYARAJ J
&
KISHORE
KUMAR M
Topics
HISTORY
DATABASE
JDBC DEFINITION
ARCHITECTURE OF JDBC
JDBC DRIVER TYPES
WHY NOT SYMPLY ADOPT ODBC MODEL ?
STEPS TO CONNECT JAVA APP. WITH DATABASE
HISTORY
Early days, data was first stored in file systems , which made it
challenging to organize and retrieve information efficiently.
In 1960, researchers started developing electronic systems to store and
manage data.
One of the earliest database model was hierarchial model, which
organized data in a tree-like structure.
In 1970, The real breakthrough came with the invention of the relational
database model by Edgar Codd .
This model introduced the concept of tables, rows, &coloumns.
In 1980 & 1990, object-oriented databases gained attention, allowing for
more complex data modelling & handling.
DATABASE
A database is structured collection of data that is
organized, stored, and managed in a computer
system .
It allows you to store & retrieve information efficiently
.
It’s
a digital filing system where you can store and
organize data in tables, rows, & columns .
Databases are commonly used in various applications
. such as websites, mobile apps & business systems,
to store & manage large amounts of data .
JDBC DEFINITION
Java Database Connectivity.
It is an interface between Java & Database .
Itreceives queries from Java Application program &
communicate with Database.
All
the communications are in the form of SQL
commands.
Architecture of
JDBC
JDBC DRIVER TYPES
1. JDBC-ODBC Bridge Driver
2. Native API Partly Java
Driver
3. Network Protocol Driver
4. Thin Driver
1) JDBC-ODBC Bridge
Driver
This Driver acts as a bridge between the
JDBC API & the ODBC (Open Database
Connectivity) API.
Itrequires the installation of ODBC driver
on the client side machine.
Itis platform dependent and may have
limited functionality & performance.
2) Native API Partly Java
Driver
ThisDriver uses the database’s native API to
establish a connection .
It converts JDBC method calls into native API calls.
Itprovides better performance compared to type
1 Driver.
It requires the installation of the database-specific
client library on the client machine.
Platform-Dependent & may have limited
portability.
3) Network Protocol
Driver
This driver uses a network protocol to
communicate with a server-side application .
It converts JDBC method calls into a protocol-
specific message format .
It does not requires the installation of any
database-specific client library on the client
machine .
It provides better portability and allows
connectivity to multiple databases .
4) Thin Driver
(Direct Protocol Driver)
The driver communicates directly with the database
server using a database-specific protocol.
It does not require any additional software installation on
the client machine.
It provides the best performance & portability among all
driver types.
It is platform-independent & can connect to multiple
databases .
It is the most commonly used driver type in modern JDBC
applications .
Why not simply adopt
ODBC model?
it is written in c language .
ODBC is hard to learn .
It has few commands with lot of
complex options .
ODBC solution is inherently less safe .
It’s not portable language as platform
dependent .
5 Steps to Connect Java
App. With Database
using JDBC
1) Register the driver class
* For using SQL, import.java.sql
• forName( )method
• used to register the driver class.
* This function loads the driver and
activates it .
2) Create connection
getConnection( ) method
Establish the connection between registered
driver and database.
Two Functions ,
1)Public Static Connection
getconnection(string URL)
2) Public Static Connection
getconnection(string URL,username,password)
3) Create the statement
object
CreateStatement( ) method
Through this we execute the query with the
object .