53509967-38144104-Java - The Java Series Introduction to...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 1 Introduction to JDBC The Java Series
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 2 What is JDBC Stands for Java Database Connectivity It s an API for programmers to access databases in an homogeneous way. With JDBC all databases are accessed in the same way. This isolates programs from details of databases. To use JDBC with any database you have to know: Standard SQL What is your database name, login, pwd, etc. But you don t have to know: The specifics of how to communicate with your database
Background image of page 2
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 3 Databases A database is a set of tables. Each table contains a set of rows according to a certain structure. Each column contains typed information (string, float, integer, etc.) Typically databases hold lots of data. COF_NAME SUP_ID PRICE SALES TOTAL --------------- ------ ----- ----- ----- Colombian 101 7.99 0 0 French_Roast 49 8.99 0 0 Espresso 150 9.99 0 0 Colombian_Decaf 101 8.99 0 0 French_Roast_Decaf 49 9.99 0 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 4 SQL Is a standard language to manipulate databases. To create tables To retrieve information To insert information To update information SELECT * FROM COFFEES WHERE PRICE>8 INSERT INTO COFFEES VALUES (‘Italian’, 101, 5.66, 0, 0) UPDATE COFFEES SET PRICE=10.99 WHERE COF_NAME='Espresso' CREATE TABLE COFFEES (COF_NAME varchar(32), SUP_ID int, PRICE float, SALES int, TOTAL int)
Background image of page 4
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 5 Although SQL is quite standard, each database has its own protocols, connection procedures, etc. before starting to use SQL. Programs wanting to access different databases must know SQL AND how to access EACH database. JDBC aims at hiding vendor specific logistics. For this, JDBC differentiates: Access, protocol, connection to the db: provided by the vendor following JDBC standards. Manipulation of the db: done by the programmer using SQL.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 6 How does JDBC work? Each database vendor provides a JDBC Driver which encapsulates all the specifics of their database. A JDBC Driver is a set of Java classes which: Follow the JDBC standards (Java interfaces). Implement connections, access, etc. to the database. To access a database the programmer must: Load the correspondent JDBC Driver. Use the JDBC API to execute SQL statements and standard database operations. To access a different database: Load a different JDBC Driver. No need to modify database manipulation code.
Background image of page 6
The Java Series. Introduction to JDBC Raul RAMOS / CERN-IT User Support Slide 7 Setting things up To access a db through JDBC, you have to: Obtain the JDBC classes. This are part of the java.sql package and are distributed as part of jdk from version 1.1 Obtain the JDBC driver for the database you want to access. Make it accessible to your java tools (classpath).
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 33

53509967-38144104-Java - The Java Series Introduction to...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online