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.

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.
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.
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.
CSE470 Software Engineering Fall Database Access through Java.
1 Foundations of Software Design Lecture 27: Java Database Programming Marti Hearst Fall 2002.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
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.
Confidential ODBC May 7, Features What is ODBC? Why Create an ODBC Driver for Rochade? How do we Expose Rochade as Relational Transformation.
Advanced OOP MCS-3 OOP BSCS-3 Lecture # 11. DATABASE CONNECTIVITY IN JAVA JDBC Programming JDBC (Java Database Connectivity) is the specification of a.
ODBC Open DataBase Connectivity a standard database access method developed by Microsoft to access data from any application regardless of which database.
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).
Web Application Development Muhammad Ali Versonic Pte Asher Imtiaz Forman Christian College.
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. –
JDBC Vs. Java Blend Presentation by Gopal Manchikanti Shivakumar Balasubramanyam.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
CSCI 6962: Server-side Design and Programming
Java Database Connectivity (JDBC) Francisco Pajaro Saul Acosta Nahum Quezada Manuel Rubio.
Java Database Connectivity (JDBC). Introduction Database –Collection of data DBMS –Database management system –Storing and organizing data SQL –Relational.
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.
Interacting With Data Databases.
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))
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.
ODBC : Open Database Connectivity SNU OOPSLA Lab. October 2005.
CSE470 Software Engineering Fall Database Access through Java.
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.
PHP Programming with MySQL Slide 8-1 CHAPTER 8 Working with Databases and MySQL.
CIS 270—Application Development II Chapter 25—Accessing Databases with JDBC.
Simple Database.
Fundamentals of Database Chapter 7 Database Technologies.
Georgia Institute of Technology Making Text for the Web part 5 Barb Ericson Georgia Institute of Technology March 2006.
Chapter 7 Working with Databases and MySQL PHP Programming with MySQL 2 nd Edition.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 MySQL and JDBC.
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,
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.
Mainframe (Host) - Communications - User Interface - Business Logic - DBMS - Operating System - Storage (DB Files) Terminal (Display/Keyboard) Terminal.
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.
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.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
12/6/2015B.Ramamurthy1 Java Database Connectivity B.Ramamurthy.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
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:
PHP Programming. Topics Database Handling (MySQL, MSSQL, ODBC)
Database Access Using JDBC BCIS 3680 Enterprise Programming.
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.
Basics of JDBC Session 14.
In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.
6-1 JAVA DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
ODBC, OCCI and JDBC overview
JDBC Database Management Database connectivity
Web Technologies IT230 Dr Mohamed Habib.
Introduction to MySQL.
JDBC.
Chapter 8 Working with Databases and MySQL
MSIS 655 Advanced Business Applications Programming
Presentation transcript:

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 backend. Language for RBMS - > SQL

SQL Structured Query Language There are many standards for SQL SQL92, SQL 89, SQL99, Some commands exists for all the standards. Some commands exists only for specific products

Why do I need JDBC? Connects to a RDBMS RDBMS Neutral Standard API (portable) Allows for transmission of SQL Can help to process results.

Using JDBC and Tiers Java program calls JDBC methods These methods transmit SQL statements The RDBMS responds, via the JDBC methods This is a 2 Tier system.

SQL Is NOT OOP language (yet) able to store instances of classes able to store blobs (unformatted sequences of bytes)

RBMS is good for storing data searching data non-programmer updates of data.

JDBC+RDBMS=2 tier computing Client + server = 2 tier computing. JDBC does connections, query and result processing from the RDBMS. JDBC uses SQL.

Process 1.Connect to DBMS 2.Instance SQL Statement 3.Execute SQL statement 4.Process SQL results 5.close connection to DBMS

3 tier system - distributed computing client web server rdbms cgi html browser w/o java jdbc jdbc results

4 tier system - distributed computing client web server rdbms cgi html browser w/o java jdbc jdbc results b-logic

Jdbc driver ideas JDBC needs to work with many DBMS Oracle mySql JET DB2 SQLServer, etc....

Mapping to a DSN... JDBC with ODBC driver is called JDBC/ODBC (microsoft method). connect using a protocol and subprotocol

How do I formulate a connect URL? String url =“jdbc:dbnet://show.docjava.com:356/addre sses” jdbc – primary protocol dbnet – sub protocol show.docjava.com – FQDN 356 – standard port for RDBMS services

What Packages do I need? import java.sql.*;

The format of the url string is vendor specific String url = “jdbc:dbnet://localhost:356/Books”; where dbnet is an example of a subprotocol, and //localhost:356/Books is an example of a subname. The DriverManager class can also take an optional user name and password. For example: Connection c = DriverManager.getConnection(url, “userid”, “password”);

Setting up a RDBMS How to set up your RDBMS How to get drivers for JDBC How to load the drivers How to set up a select few IDEs for programming

data source name (DSN) The DSN can be set using one of several techniques. Under Windows, double-click the ODBC Data Sources (32bit) control panel.

Using Appendix H ODBC Data Source Administrator is shown upon opening the ODBC Data Sources control panel. Select the MS Access Database driver and click Add...

Adding a database

Create a new data source

Set up

Add the DSN

MDB Files look like:

Mapping the DSN File:

Using odbc to mysql myodbc.html Access to mysql via odbc driver

Configuration

Accessing and ODBC database

Select your Data Source

Select your tables

Click on the tables

Setting up mysql >mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 to server version: beta-log Type 'help' for help. mysql> use test Database changed

Make a table mysql> create table User ( UserId varchar(10), Password varchar(10)); Query OK, 0 rows affected (0.06 sec) To create a more more complex table (for example a phone book) use: mysql> create table phonelist (firstname varchar(20),lastname varchar(20), address1 varchar(255), address2 varchar(255), phone1 varchar(50), phone2 varchar(50), phone3 varchar(50)); Query OK, 0 rows affected (0.04 sec) mysql> show tables;

Get a driver.

grant access to the user mysql> show grants ; grant create on *.* to guest; Query OK, 0 rows affected (0.08 sec) mysql> use test; Database changed mysql> create table flatfile (message char(255)); Query OK, 0 rows affected (0.02 sec)

Loading a table Use the load command to import data from a text file. For example: mysql> LOAD DATA LOCAL INFILE “c:\lyon\j4p\src\addbk\JAddressBook\foo.cs v" INTO TABLE phonelist FIELDS TERMINATED BY '\t' (name, kind, createdDate, modifiedDate);

Selecting records select * from flatfile;

class DataBaseMetaData is obtained automatically by the SqlBean Class.forName(driver); c = DriverManager.getConnection(url,userId,password); dbmd = c.getMetaData(); catalogName = c.getCatalog(); isReadOnly = c.isReadOnly(); usesLocalFiles = dbmd.usesLocalFiles(); driverName = dbmd.getDriverName();

For Next Week Make the addressbook program index work so that selecting a letter will display the index so that it starts from that letter. Use the first letter that appears in the name field. If you select ‘I’ but there are no records that start with ‘I’ go to the record preceding where I should be.. For ‘a’ go to the beginning.

Implements the CSV features Using your jtable, import from text files via a delimiter panel. Using the delimiter panel, export your text files.