Java applications cannot directly communicate with a database to submit data and retrieve the results of queries.
This is because a database can interpret only SQL statements and not Java language statements.
For this reason, you need a mechanism to translate Java statements into SQL statements.
The JDBC architecture provides the mechanism for this kind of translation.
The JDBC architecture can be classified into two layers :
JDBC application layer.
JDBC driver layer.
JDBC application layer : Signifies a Java application that uses the JDBC API to interact with the JDBC drivers. A JDBC driver is software that a Java application uses to access a database. The JDBC driver manager of JDBC API connects the Java application to the driver.
JDBC driver layer : Acts as an interface between a Java applications and a database. This layer contains a driver , such as a SQL server driver or an Oracle driver , which enables connectivity to a database.
A driver sends the request of a Java application to the database. After processing the request, the database sends the response back to the driver. The driver translates and sends the response to the JDBC API. The JDBC API forwards it to the Java application.
Java applications cannot directly communicate with a database to submit data and retrieve the results of queries.
This is because a database can interpret only SQL statements and not Java language statements.
For this reason, you need a mechanism to translate Java statements into SQL statements.
The JDBC architecture provides the mechanism for this kind of translation.
The JDBC architecture can be classified into two layers :
JDBC application layer.
JDBC driver layer.
JDBC application layer : Signifies a Java application that uses the JDBC API to interact with the JDBC drivers. A JDBC driver is software that a Java application uses to access a database. The JDBC driver manager of JDBC API connects the Java application to the driver.
JDBC driver layer : Acts as an interface between a Java applications and a database. This layer contains a driver , such as a SQL server driver or an Oracle driver , which enables connectivity to a database.
A driver sends the request of a Java application to the database. After processing the request, the database sends the response back to the driver. The driver translates and sends the response to the JDBC API. The JDBC API forwards it to the Java application.
This presentation discusses the following topics:
Object Oriented Databases
Object Oriented Data Model(OODM)
Characteristics of Object oriented database
Object, Attributes and Identity
Object oriented methodologies
Benefit of object orientation in programming language
Object oriented model vs Entity Relationship model
Advantages of OODB over RDBMS
Coda (Constant Data Avaialabilty) is a distributed file system developed at Carnegie Mellon University . This presentation explains how it works and different aspects of it.
Object Definition Language (ODL) is a specification language to define the specifications of object types based on the ODMG ODL (but not compliant). ODL is a DDL for objects types. ... If defines the characteristics of types, including their properties and operations.
Transactions and Concurrency Control in distributed systems. Transaction properties, classification, and transaction implementation. Flat, Nested, and Distributed transactions. Inconsistent Retrievals, Lost Update, Dirty Read, and Premature Writes Problem
This presentation discusses the following topics:
Object Oriented Databases
Object Oriented Data Model(OODM)
Characteristics of Object oriented database
Object, Attributes and Identity
Object oriented methodologies
Benefit of object orientation in programming language
Object oriented model vs Entity Relationship model
Advantages of OODB over RDBMS
Coda (Constant Data Avaialabilty) is a distributed file system developed at Carnegie Mellon University . This presentation explains how it works and different aspects of it.
Object Definition Language (ODL) is a specification language to define the specifications of object types based on the ODMG ODL (but not compliant). ODL is a DDL for objects types. ... If defines the characteristics of types, including their properties and operations.
Transactions and Concurrency Control in distributed systems. Transaction properties, classification, and transaction implementation. Flat, Nested, and Distributed transactions. Inconsistent Retrievals, Lost Update, Dirty Read, and Premature Writes Problem
Java to database connectivity for beginners, Introduction to JDBC, Getting Started with java database programming, What is java database?, core java, java to standard edition, core java, java
Introduction to JDBC and database access in web applicationsFulvio Corno
Introduction to the JDBC standard and best practices for database access from Web Applications.
Materiale realizzato per il corso di Sistemi Informativi Aziendali del Politecnico di Torino - http://bit.ly/sistinfo
Database Programming: The Design of JDBC, The Structured Query Language, Basic JDBC Programming Concepts,
Result Sets, Metadata, Row Sets, Transactions
Java DataBase Connectivity API (JDBC API)Luzan Baral
JDBC is a Java-based data access technology (Java Standard Edition platform) from Oracle Corporation. This technology is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. A JDBC-to-ODBC bridge enables connections to any ODBC-accessible data source in the JVM host environment.
Student information management system project report ii.pdfKamal Acharya
Our project explains about the student management. This project mainly explains the various actions related to student details. This project shows some ease in adding, editing and deleting the student details. It also provides a less time consuming process for viewing, adding, editing and deleting the marks of the students.
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfKamal Acharya
The College Bus Management system is completely developed by Visual Basic .NET Version. The application is connect with most secured database language MS SQL Server. The application is develop by using best combination of front-end and back-end languages. The application is totally design like flat user interface. This flat user interface is more attractive user interface in 2017. The application is gives more important to the system functionality. The application is to manage the student’s details, driver’s details, bus details, bus route details, bus fees details and more. The application has only one unit for admin. The admin can manage the entire application. The admin can login into the application by using username and password of the admin. The application is develop for big and small colleges. It is more user friendly for non-computer person. Even they can easily learn how to manage the application within hours. The application is more secure by the admin. The system will give an effective output for the VB.Net and SQL Server given as input to the system. The compiled java program given as input to the system, after scanning the program will generate different reports. The application generates the report for users. The admin can view and download the report of the data. The application deliver the excel format reports. Because, excel formatted reports is very easy to understand the income and expense of the college bus. This application is mainly develop for windows operating system users. In 2017, 73% of people enterprises are using windows operating system. So the application will easily install for all the windows operating system users. The application-developed size is very low. The application consumes very low space in disk. Therefore, the user can allocate very minimum local disk space for this application.
Automobile Management System Project Report.pdfKamal Acharya
The proposed project is developed to manage the automobile in the automobile dealer company. The main module in this project is login, automobile management, customer management, sales, complaints and reports. The first module is the login. The automobile showroom owner should login to the project for usage. The username and password are verified and if it is correct, next form opens. If the username and password are not correct, it shows the error message.
When a customer search for a automobile, if the automobile is available, they will be taken to a page that shows the details of the automobile including automobile name, automobile ID, quantity, price etc. “Automobile Management System” is useful for maintaining automobiles, customers effectively and hence helps for establishing good relation between customer and automobile organization. It contains various customized modules for effectively maintaining automobiles and stock information accurately and safely.
When the automobile is sold to the customer, stock will be reduced automatically. When a new purchase is made, stock will be increased automatically. While selecting automobiles for sale, the proposed software will automatically check for total number of available stock of that particular item, if the total stock of that particular item is less than 5, software will notify the user to purchase the particular item.
Also when the user tries to sale items which are not in stock, the system will prompt the user that the stock is not enough. Customers of this system can search for a automobile; can purchase a automobile easily by selecting fast. On the other hand the stock of automobiles can be maintained perfectly by the automobile shop manager overcoming the drawbacks of existing system.
Courier management system project report.pdfKamal Acharya
It is now-a-days very important for the people to send or receive articles like imported furniture, electronic items, gifts, business goods and the like. People depend vastly on different transport systems which mostly use the manual way of receiving and delivering the articles. There is no way to track the articles till they are received and there is no way to let the customer know what happened in transit, once he booked some articles. In such a situation, we need a system which completely computerizes the cargo activities including time to time tracking of the articles sent. This need is fulfilled by Courier Management System software which is online software for the cargo management people that enables them to receive the goods from a source and send them to a required destination and track their status from time to time.
Explore the innovative world of trenchless pipe repair with our comprehensive guide, "The Benefits and Techniques of Trenchless Pipe Repair." This document delves into the modern methods of repairing underground pipes without the need for extensive excavation, highlighting the numerous advantages and the latest techniques used in the industry.
Learn about the cost savings, reduced environmental impact, and minimal disruption associated with trenchless technology. Discover detailed explanations of popular techniques such as pipe bursting, cured-in-place pipe (CIPP) lining, and directional drilling. Understand how these methods can be applied to various types of infrastructure, from residential plumbing to large-scale municipal systems.
Ideal for homeowners, contractors, engineers, and anyone interested in modern plumbing solutions, this guide provides valuable insights into why trenchless pipe repair is becoming the preferred choice for pipe rehabilitation. Stay informed about the latest advancements and best practices in the field.
Vaccine management system project report documentation..pdfKamal Acharya
The Division of Vaccine and Immunization is facing increasing difficulty monitoring vaccines and other commodities distribution once they have been distributed from the national stores. With the introduction of new vaccines, more challenges have been anticipated with this additions posing serious threat to the already over strained vaccine supply chain system in Kenya.
Cosmetic shop management system project report.pdfKamal Acharya
Buying new cosmetic products is difficult. It can even be scary for those who have sensitive skin and are prone to skin trouble. The information needed to alleviate this problem is on the back of each product, but it's thought to interpret those ingredient lists unless you have a background in chemistry.
Instead of buying and hoping for the best, we can use data science to help us predict which products may be good fits for us. It includes various function programs to do the above mentioned tasks.
Data file handling has been effectively used in the program.
The automated cosmetic shop management system should deal with the automation of general workflow and administration process of the shop. The main processes of the system focus on customer's request where the system is able to search the most appropriate products and deliver it to the customers. It should help the employees to quickly identify the list of cosmetic product that have reached the minimum quantity and also keep a track of expired date for each cosmetic product. It should help the employees to find the rack number in which the product is placed.It is also Faster and more efficient way.
Final project report on grocery store management system..pdfKamal Acharya
In today’s fast-changing business environment, it’s extremely important to be able to respond to client needs in the most effective and timely manner. If your customers wish to see your business online and have instant access to your products or services.
Online Grocery Store is an e-commerce website, which retails various grocery products. This project allows viewing various products available enables registered users to purchase desired products instantly using Paytm, UPI payment processor (Instant Pay) and also can place order by using Cash on Delivery (Pay Later) option. This project provides an easy access to Administrators and Managers to view orders placed using Pay Later and Instant Pay options.
In order to develop an e-commerce website, a number of Technologies must be studied and understood. These include multi-tiered architecture, server and client-side scripting techniques, implementation technologies, programming language (such as PHP, HTML, CSS, JavaScript) and MySQL relational databases. This is a project with the objective to develop a basic website where a consumer is provided with a shopping cart website and also to know about the technologies used to develop such a website.
This document will discuss each of the underlying technologies to create and implement an e- commerce website.
Event Management System Vb Net Project Report.pdfKamal Acharya
In present era, the scopes of information technology growing with a very fast .We do not see any are untouched from this industry. The scope of information technology has become wider includes: Business and industry. Household Business, Communication, Education, Entertainment, Science, Medicine, Engineering, Distance Learning, Weather Forecasting. Carrier Searching and so on.
My project named “Event Management System” is software that store and maintained all events coordinated in college. It also helpful to print related reports. My project will help to record the events coordinated by faculties with their Name, Event subject, date & details in an efficient & effective ways.
In my system we have to make a system by which a user can record all events coordinated by a particular faculty. In our proposed system some more featured are added which differs it from the existing system such as security.
Democratizing Fuzzing at Scale by Abhishek Aryaabh.arya
Presented at NUS: Fuzzing and Software Security Summer School 2024
This keynote talks about the democratization of fuzzing at scale, highlighting the collaboration between open source communities, academia, and industry to advance the field of fuzzing. It delves into the history of fuzzing, the development of scalable fuzzing platforms, and the empowerment of community-driven research. The talk will further discuss recent advancements leveraging AI/ML and offer insights into the future evolution of the fuzzing landscape.
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Dr.Costas Sachpazis
Terzaghi's soil bearing capacity theory, developed by Karl Terzaghi, is a fundamental principle in geotechnical engineering used to determine the bearing capacity of shallow foundations. This theory provides a method to calculate the ultimate bearing capacity of soil, which is the maximum load per unit area that the soil can support without undergoing shear failure. The Calculation HTML Code included.
2. Overview (1/2)
JDBC
JDBC is a standard interface for connecting to relational databases
from Java
The JDBC Classes and Interfaces are in the java.sql package
JDBC is Java API for executing SQL statements
Provides a standard API for tool/database developers
Possible to write database applications using a pure Java API
Easy to send SQL statements to virtually any relational database
What does JDBC do?
Establish a connection with a database
Send SQL statements
Process the results
JDBC Driver
JAVA Applet/
Application Database
JDBC Call
Database
Command
3. Reason for JDBC
Database vendors (Microsoft Access, Oracle etc.) provide
proprietary (non standard) API for sending SQL to the server
and receiving results from it
Languages such as C/C++ can make use of these proprietary
APIs directly
High performance
Can make use of non standard features of the database
All the database code needs to be rewritten if you change
database vendor or product
JDBC is a vendor independent API for accessing relational
data from different database vendors in a consistent way
CCTM: Course material developed by James King (james.king@londonmet.ac.uk)
Overview (2/2)
4. History of JDBC (1/2)
JDBC 1.0 released 9/1996.
Contains basic functionality to connect to database, query database,
process results
JDBC classes are part of java.sql package
Comes with JDK 1.1
JDBC 2.0 released 5/1998
Comes with JDK 1.2
javax.sql contains additional functionality
Additional functionality:
Scroll in result set or move to specific row
Update database tables using Java methods instead of SQL
commands
Send multiple SQL statements to the database as a batch
Use of SQL3 datatypes as column values
5. History of JDBC (2/2)
JDBC 3.0 released 2/2002
Comes with Java 2, J2SE 1.4
Support for:
Connection pooling
Multiple result sets
Prepared statement pooling
Save points in transactions
6. JDBC Model
JDBC consists of two parts:
JDBC API, a purely Java-based API
JDBC driver manager
Communicates with vendor-specific
drivers
Connection con =
DriverManager.getConnection( "jd
bc:myDriver:myDatabase",
username, password);
JAVA Applet/
Application
JDBC API
Driver Manager
Driver API
Vendor Specific
JDBC Driver
JDBC-ODBC Bridge
Database
Vender Specific
ODBC Driver
Database
Java Application
Developer
JDBC Developer
Vender Specific
JDBC developer
7. JDBC Programming Steps
Connect
Query
Process Results
Close
1) Register the driver
2) Create a connection to the database
1) Create a statement
2) Query the database
1) Get a result set
2) Assign results to Java variables
1) Close the result set
2) Close the statement
3) Close the connection
8. Skeleton Code
Class.forName(DRIVERNAME);
Connection con = DriverManager.getConnection(
CONNECTIONURL, DBID, DBPASSWORD);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(“SELECT a, b, c FROM member);
While(rs.next())
{
Int x = rs.getInt(“a”);
String s = rs.getString(“b”);
Float f = rs.getFloat(“c”);
}
rs.close();
stmt.close();
con.close();
Loading a JDBC driver
Connecting to a database
Processing the result set
Closing the connections
Executing SQL
9. Step 1 : Loading a JDBC Driver
A JDBC driver is needed to connect to a database
Loading a driver requires the class name of the driver.
Ex) JDBC-ODBC: sun.jdbc.odbc.JdbcOdbcDriver
Oracle driver: oracle.jdbc.driver.OracleDriver
MySQL: com.mysql.jdbc.Driver
Loaing the driver class
Class.forName("com.mysql.jdbc.Driver");
It is possible to load several drivers.
The class DriverManager manages the loaded driver(s)
10. Step 2 : Connecting to a Database (1/2)
JDBC URL for a database
Identifies the database to be connected
Consists of three-part:
jdbc:<subprotocol>:<subname>
Protocol: JDBC is
the only protocol in
JDBC
Protocol: JDBC is
the only protocol in
JDBC
Subname: indicates the location and
name of the database to be
accessed. Syntax is driver specific
Subname: indicates the location and
name of the database to be
accessed. Syntax is driver specific
Sub-protocol:
identifies a
database
driver
Sub-protocol:
identifies a
database
driver
Ex) jdbc:mysql://oopsla.snu.ac.kr/mydb
The syntax for the name of the database is a little messy and is
unfortunately vendor specific
11. JDBC URL
Vendor of database, Location of
database server and name of
database
Username Password
Step 2 : Connecting to a Database (2/2)
The DriverManager allows you to connect to a database using
the specified JDBC driver, database location, database name,
username and password.
It returns a Connection object which can then be used to
communicate with the database.
Connection connection =
DriverManager.getConnection("jdbc:mysql://oopsla.snu.ac.kr/mydb",“useri
d",“password");
JDBC URL
Vendor of database, Location of
database server and name of
database
Username Password
12. Step 3 : Executing SQL (1/2)
Statement object
Can be obtained from a Connection object
Sends SQL to the database to be executed
Statement has three methods to execute a SQL statement:
executeQuery() for QUERY statements
Returns a ResultSet which contains the query results
executeUpdate() for INSERT, UPDATE, DELETE statements
Returns an integer, the number of affected rows from the SQL
execute() for either type of statement
Statement statement = connection.createStatement();
13. Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery
("select RENTAL_ID, STATUS from ACME_RENTALS");
Statement stmt = conn.createStatement();
int rowcount = stmt.executeUpdate
("delete from ACME_RENTAL_ITEMS
where rental_id = 1011");
Step 3 : Executing SQL (2/2)
Execute a select statement
Execute a delete statement
14. Step 4 : Processing the Results (1/2)
JDBC returns the results of a query in a ResultSet object
ResultSet object contains all of the rows which satisfied the conditions
in an SQL statement
A ResultSet object maintains a cursor pointing to its current
row of data
Use next() to step through the result set row by row
next() returns TRUE if there are still remaining records
getString(), getInt(), and getXXX() assign each value to a Java
variable
Record 1 Record 2 Record 3 Record 4
ResultSetInternal Pointer
The internal pointer starts one before the first record
15. Step 4 : Processing the Results (2/2)
Example
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(“SELECT ID, name, score FROM table1”);
While (rs.next()){
int id = rs.getInt(“ID”);
String name = rs.getString(“name”);
float score = rs.getFloat(“score”);
System.out.println(“ID=” + id + “ ” + name + “ ” + score);}
NOTE
You must step the cursor to the first record before read the results
This code will not skip the first record
ID name score
1 James 90.5
2 Smith 45.7
3 Donald 80.2
Table1
Output
ID=1 James 90.5
ID=2 Smith 45.7
ID=3 Donald 80.2
16. Step 5 : Closing Database Connection
It is a good idea to close the Statement and Connection objects
when you have finished with them
Close the ResultSet object
rs.close();
Close the Statement object
stmt.close();
Close the connection
connection.close();
17. The PreparedStatement Object
A PreparedStatement object holds precompiled SQL
statements
Use this object for statements you want to execute more than
once
A PreparedStatement can contain variables (?) that you supply
each time you execute the statement
// Create the prepared statement
PreparedStatement pstmt = con.prepareStatement(“
UPDATE table1 SET status = ? WHERE id =?”)
// Supply values for the variables
pstmt.setString (1, “out”);
pstmt.setInt(2, id);
// Execute the statement
pstmt.executeUpdate();
Editor's Notes
Dynamically Executing an Unknown SQL Statement
The following example uses execute() to dynamically execute an unknown statement:
public void executeStmt (String statement) throws SQLException { Statement stmt = conn.createStatement(); // Execute the statement boolean result = stmt.execute(statement); if (result) {// statement was a query ResultSet rset = stmt.getResultSet(); // Process the results ... } else {// statement was an update or DDL int updateCount = stmt.getUpdateCount(); // Process the results ... }}