JDBC. SQL(Structured Query Language) is divided into 1.DDL(Data Definition Language) create db, create table, alter table, drop db or table 2.DML(Data.

Slides:



Advertisements
Similar presentations
Connecting to Databases. connecting to DB DB server typically a standalone application Server runs on localhost for smaller sites –i.e. Same machine as.
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Copyright  Oracle Corporation, All rights reserved. 2 Java and Databases: An Overview.
Java and Databases CS-328 Dick Steflik. Database Drivers Think of a database as just another device connected to your computer like other devices it has.
Distributed Application Development B. Ramamurthy.
SQL (Structured Query Language) X/OPEN Call Level Interface For SQL ODBC (Open DataBase Connectivity) API JDBC (Java DataBase Connectivity) API SQL (Structured.
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
JDBC. In This Class We Will Cover: What SQL is What ODBC is What JDBC is JDBC basics Introduction to advanced JDBC topics.
1 Design patterns Lecture 4. 2 Three Important skills Understanding OO methodology Mastering Java language constructs Recognizing common problems and.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
JDBC / ODBC JDBC is the java API that facilitate interaction of a java application with the DBMS. FIRST APPROACH:
Dale Roberts 8/24/ Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
Java Database Connectivity (JDBC) Francisco Pajaro Saul Acosta Nahum Quezada Manuel Rubio.
CSE470 Software Engineering Fall Database Access through Java.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Database Programming in Java Corresponds with Chapter 32, 33.
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
Dr R R DOCSIT, Dr BAMU. Basic Java : Introduction to JDBC 2 Objectives of This Session State what is Java Database Connectivity State different.
Designing and Developing WS B. Ramamurthy. Plans We will examine the resources available for development of JAX-WS based web services. We need an IDE,
Connecting to Oracle using Java November 4, 2009 David Goldschmidt, Ph.D. David Goldschmidt, Ph.D.
Quick review of SQL And conversion to Oracle SQL.
JDBC. Preliminaries Database Database Collection of data Collection of data DBMS DBMS Database management system Database management system Stores and.
Accessing Database using JDBC. JDBC Objectives Gain basic knowledge of Java JDBC Become familiar with the basics of interacting with a database using.
COMP201 Java Programming Topic 15: Database Connectivity JDBC Reading: Chapter 4, Volume 2.
Java Database Connectivity (JDBC). Topics 1. The Vendor Variation Problem 2. SQL and Versions of JDBC 3. Creating an ODBC Data Source 4. Simple Database.
Java Database Connectivity. Java and the database Database is used to store data. It is also known as persistent storage as the data is stored and can.
JDBC Database Programming in Java Prepared by., Mrs.S.Amudha AP/SWE.
JDBC CHAPTER-2. JDBC - Java Database Connectivity. JDBC from Sun Microsystems provides API or Protocol to interact with different databases. With the.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
JDBC
Java and Databases. JDBC Architecture Java Application JDBC API Data Base Drivers AccessSQL Server DB2InformixMySQLSybase.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Java JDBC API. A Java API To Access almost any kind of tabular data To Access almost any kind of tabular data Trademarked (not an acronym) Trademarked.
DataBases and SQL INFSY 547 Spring Course Wrap Up April 12: Complete Work on Servlets Review of Team Projects Close of Portfolio Work April 19:
JDBC CS 260 Database Systems. Overview  Introduction  JDBC driver types  Eclipse project setup  Programming with JDBC  Prepared statements  SQL.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
Basics of JDBC Session 14.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 6 CGI/Perl and databases.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
JDBC Chapter 1 JDBC Introduction
JDBC - Java Database Connectivity. JDBC provides Java applications with access to most database systems via SQL The architecture and API closely resemble.
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
Ch. NoNameMarks 01AWT24 02Networking18 03JDBC20 04Swing18 05Servlet20 Advance Java Programming.
Physical Layer of a Repository. March 6, 2009 Agenda – What is a Repository? –What is meant by Physical Layer? –Data Source, Connection Pool, Tables and.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
SQL Basics Review Reviewing what we’ve learned so far…….
JDBC. Database is used to store data permanently. These days almost all Applications needs database to store its data persistently. Below are the most.
DEPTT. OF COMP. SC & APPLICATIONS
Note: To complete the examples in this section you need access to a database!! Most of the examples work for any database with JDBC drivers. However, connecting.
Interacting with Database
ODBC, OCCI and JDBC overview
JDBC Database Management Database connectivity
Distributed Computing
The Basics of Data Manipulation
Client Access, Queries, Stored Procedures, JDBC
SQL 101.
Interacting with Database
The Basics of Data Manipulation
مقدمة في قواعد البيانات
Java Database Connectivity
ODBC and JDBC.
Java API for Database Connectivity
Data Access Layer (Con’t) (Overview)
Presentation transcript:

JDBC

SQL(Structured Query Language) is divided into 1.DDL(Data Definition Language) create db, create table, alter table, drop db or table 2.DML(Data manipulation Language) insert, select, update, delete, truncate 3.TCL(Transaction Control Language) commit, rollback 4.DCL(Data Control Language) grant, revoke

Column Constraints Below are column constraints which can be specified while creating or altering table 1.NOT NULL – NULL Values not allowed 2.DEFAULT – default value is used, if no value is specified in insert stmt 3.PRIMARY KEY – ensures all values are different in a column 4.AUTO_INCREMENT – Automatically increments a column value, when new record is inserted

Java Application JDBC Driver Database Server Java Database Connectivity

JDBC(Java Database Connectivity) JDBC Acts as an interface between Java Application and Database. Package used for Java Applications to interact with database is java.sql

Java.sql package

You are also using the ojdb14.jar from Oracle, probably with a "thin" jdbc configuration, which means you are using a type-4 driver configuration. With such a configuration, you will only need to deploy the JDBC jar file with your database accessing program. The other options include a JDBC bridge, which really means an ODBC connection wrapped in JDBC clothing. This means you would have to configure your system for correct ODBC function, and then use a JAR file to access ODBC. Due to the extra "hop" of data through ODBC, one would expect it to be a bit slower than a type-4 access; however, there is a possibility that the ODBC is optimized to such a great extent for a particular situation, that the extra hop is negligible. As with most performance concerns, the truth is discovered by testing (in your environment). The type-2 drivers again use a Java (JDBC) API; however, they bridge the calls into a C or C++ style shared library, which then handles the real connection. If the driver is optimized to be so fast that the JNI setup / tear down calls are negligible in cost, then perhaps it might outperform type-4 drivers. Type 3 drivers basically proxy (or relay) the request to another network resource. That typically incurs an extra network hit, but again, that doesn't say much about actual performance. Type 4 drivers are the ones you probably want to stick with. The Java program connects directly to the database, meaning that if there is a problem, it will be captured entirely within the JVM of the program making the connection (type 1, it's in the ODBC layer, type 2 it's in the native compiled code, type 3 it's in the remote network proxy).

Type 1: JDBC-ODBC Bridge driver (Bridge) Type 2: Native-API/partly Java driver (Native) Type 3: AllJava/Net-protocol driver (Middleware) Type 4: All Java/Native-protocol driver (Pure) Currently Type4 driver is used Differs in Performances and portability

Type 1 Type 2 Type 3 Type 4

Difference between different types of JDBC driver comes from the fact how they work, which is basically driven by two factor, portability and performance. Type 1 JDBC driver is the poorest in terms of portability and performance, while type 4 JDBC driver is highly portable and gives best performance.