Advanced OOP MCS-3 OOP BSCS-3 Lecture # 11. DATABASE CONNECTIVITY IN JAVA JDBC Programming JDBC (Java Database Connectivity) is the specification of a.

Slides:



Advertisements
Similar presentations
CE203 - Application Programming Autumn 2013CE203 Part 51 Part 5.
Advertisements

Aqua Data Studio. Find the application We are using Aqua Data Studio v11.
Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
Java Database Connectivity (JDBC). 2/24 JDBC (Java DataBase Connectivity) - provides access to relational database systems JDBC is a vendor independent.
Distributed Application Development B. Ramamurthy.
DT228/3 Web Development Databases. Database Almost all web application on the net access a database e.g. shopping sites, message boards, search engines.
Java database Programming JDBC Trademarked name of a Java API that supports Java programs that access relational databases Stand for Java DataBase Connectivity.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
ODBC and JDBC What are they – libraries of function calls that support SQL statements Why do we need them –Provide a way for an application to communicate.
HOW TO CREATE DSN ON WINDOWS 7. Step 1. Click Start Step 2. Click Control Panel.
JDBC / ODBC JDBC is the java API that facilitate interaction of a java application with the DBMS. FIRST APPROACH:
Introduction to JDBC (Java Database Connectivity).
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam.
Java Database Connectivity (JDBC) Francisco Pajaro Saul Acosta Nahum Quezada Manuel Rubio.
1 Java Database Connection (JDBC) There are many industrial-strength DBMS's commercially available in the market. Oracle, DB2, and Sybase are just a few.
JDBC Java Database Connectivity. What is an RDBMS? Relational database management system. There are other kinds of DBMS. Access is a GUI on a JET RBDMS.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 8 Object Oriented Programming in Java Advanced Topics Java Database.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Jaeki Song JAVA Lecture 11 Java Database Connectivity.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java/jsp program to connect to any database.
© Wang Bin 2004 JDBC ----Java Database Connectivity.
Lecture On Database Analysis and Design By- Jesmin Akhter Lecturer, IIT, Jahangirnagar University.
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.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
Georgia Institute of Technology Making Text for the Web part 5 Barb Ericson Georgia Institute of Technology March 2006.
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
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.
JDBC. JDBC stands for Java Data Base Connectivity. JDBC is different from ODBC in that – JDBC is written in Java (hence is platform independent, object.
MIS 3023 Business Programming II Professor: Akhilesh Bajaj Introduction to JDBC © Akhilesh Bajaj, All Rights Reserved.
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.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
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.
Computer Science [3] Java Programming II - Laboratory Course Lab 9: Accessing Databases with JDBC Instructions on Setting Accesses Connecting to and Querying.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
Li Tak Sing COMPS311F. Database programming JDBC (Java Database Connectivity) Java version of ODBC (Open Database Connectivity) ODBC provides a standard.
JDBC
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.
AVCE ICT – Unit 7 - Programming Session 16 – Database and VB.
225 City Avenue, Suite 106 Bala Cynwyd, PA , phone , fax Connecting to a Database.
PHP Programming. Topics Database Handling (MySQL, MSSQL, ODBC)
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.
JDBC (Java Database Connectivity)
Introduction to JDBC Instructor: Mohamed Eltabakh 1.
6-1 JAVA DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
R EMAINING TOPICS IN JDBC Sagun Dhakhwa. O VERVIEW Introduction to JDBC API Types of JDBC Drivers Introduction to ODBC.
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.
, MS-Access, QBE, Access/Oracle
JDBC Database Management Database connectivity
Advanced Web Automation Using Selenium
Aqua Data Studio.
Interacting with Database
JDBC – ODBC DRIVERS.
MSIS 655 Advanced Business Applications Programming
Java Database Connectivity
JAVA DATABaSE CONNECTIVITY
ODBC and JDBC.
Java API for Database Connectivity
JDBC Example.
Presentation transcript:

Advanced OOP MCS-3 OOP BSCS-3 Lecture # 11

DATABASE CONNECTIVITY IN JAVA JDBC Programming JDBC (Java Database Connectivity) is the specification of a Java API that allows Java programs to access DBMSs. The JDBC API consists of a set of interfaces and classes written in the Java programming language. Using these standard interfaces and classes, programmers can write applications that connect to databases, send queries written in structured query language (SQL), and process the results. JDBC Programming Steps 1)Create a connection to the database 1)Create a statement 2)Query the database 1)Close the result set 2)Close the statement 3)Close the connection Connect Query Process Results Close Register 1)Register the driver 1)Get a result set 2)Assign results to Java variables

DATABASE CONNECTIVITY IN JAVA A JDBC driver is needed to connect to a database. Registering a driver requires the class name of the driver. Example) JDBC-ODBC: sun.jdbc.odbc.JdbcOdbcDriver Oracle driver: oracle.jdbc.driver.OracleDriver MySQL: com.mysql.jdbc.Driver Loading the driver class Class.forName(String); Defined in java.lang.Class (no need to import) It is possible to load several drivers. The class DriverManager manages the loaded driver(s). STEP 1: Register

DATABASE CONNECTIVITY IN JAVA JDBC URL for a database Identifies the database to be connected Consists of three-parts: : : 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. java.sql.DriverManager Connection getConnection(String)//url Connection getConnection(String, String, String)//url, username, password STEP 2: Connect 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. DSN name should be used. Sub-protocol: identifies a database driver

DATABASE CONNECTIVITY IN JAVA DSN A Data Source Name (DSN) is the logical name that is used by Open Database Connectivity (ODBC) to refer to the driver and other information that is required to access data. Create a System DSN in Windows From Control Panel, open Administrative Tools, and then open Data Sources(ODBC). Click the System DSN tab, and then click Add. Click the database driver that corresponds with the database type to which you are connecting, and then click Finish. Type the data source name. Make sure that you choose a name that you can remember. You will need to use this name later. Click Select. Click the correct database, and then click OK. Click OK, and then click OK.

GOOD LUCK ! ☻...