Presentation is loading. Please wait.

Presentation is loading. Please wait.

In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.

Similar presentations


Presentation on theme: "In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan."— Presentation transcript:

1 In the Name Of Almighty Allah

2 Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan

3 Table of Contents What is Mysql ? What is API ? ODBC. JDBC. Creating a Project in Java.

4 What is Mysql ? After this Slide you will Learn 1: A little about Mysql. 2: Creating Database in MYSQL. 3:Creating tables. 4:Inserting data in the specific created table. 5:Viewing the content of the tables.

5 A little about MYSQL Definition :MYSQL is a relational database Management System (RDBMS) that runs as a server providing multi- user access to a number of databases.  MYSQL is an open source SQL DBMS.  I It is a relational Database.(seperated tables for data. TThe (sql) stands for (Structured Query Language.  Developed, Distributed and supported by Sun Microsystems inc

6 Creating Database in MYSQL. Creating Database. Enter in the console of the MYSQL. Enter the password for the authentication.(By Default there is no Password) Now to create a database type Create Database yourdatabaseName ;

7 Creating tables. First of all you should determine the Database in which you are going to add a table. (use yourdatabaseName;) Now make a table by the name of profile. (Create table profile(firstname varchar(30),lastname varchar(30);) Varchar means specified attribute can take how many characters.(Variable Character).

8 Inserting data in the specific created table. Determine the Database then you can fill the tables with the values you want to enter. Entering Values in the table (insert into profile values (“Shafiullah”,”Sahibzada”);)

9 Viewing the content of the tables. To view the values of all the table you entered, first of all you should determine the Database then you are able to see the contents. To view the content (select * from profile;) +------------+-----------+ | firstname | lastname | +------------+-----------+ | Hasibullah | Sahibzada | | naqibullah | Sahibzada | | Atiqullah | Sahibzada | | Shafiullah | Sahibzada | +------------+-----------+

10 What is API ? API = Application Programming Interface. Definition : API is an interface implemented by a software program to enable interaction with other software. Similar to UI (User Interface) in computers that human can communicate with computers. API consists of Objects that developers can use them to add functionality to a project UI has two interface (CLI,GUI).

11 Sample Database Application APPLICATIONAPPLICATION DBMSDB

12 Multi Databases APPLICATIONAPPLICATION DBMS 1 DBMS 2 DBMS 3 DB

13 ODBC Open Database Connectivity (ODBC). Definition: ODBC is API to access information from numerous types of databases,including Access,dbase,DB2,oracle and more. ODBC standard : Contains: A Data Source that is the database, its associated DBMS, operating system and network platform A DBMS Driver that is supplied by the DBMS vendor or independent software companies A Driver Manager that is supplied by the vendor of the O/S platform where the application is running

14 An Example 07/06/10B.Ramamurthy14 ApplicationDriverManager Sybase drivermSQL driverInformix driver odbc standard API

15 Application in Java 07/06/10B.Ramamurthy15 Application in Java DriverManager Sybase drivermSQL driverInformix driver odbc standard API jdbc API

16 What is JDBC ? JDBC = Java Database Connector. Deffination : JDBC Is an API for the java programming language that define how a client may access a database. JDBC provides a lot of methods like querying,updating and more. JDBC is specially used for relational databases.

17 JDBC Components Driver Manager: Loads database drivers, and manages the connection between application & driver. Driver: Translates API calls to operations for a specific data source. Connection: A session between an application and a driver. Statement: A SQL statement to perform a query or an update operation. Metadata: Information about the returned data, driver and the database. Result Set : Logical set of columns and rows returned by executing a statement.

18 JDBC Classes Java supports DB facilities by providing classes and interfaces for its components DriverManager class Connection interface (abstract class) Statement interface (to be instantiated with values from the actual SQL statement) ResultSet interface

19 Application Connection Driver Manager Driver DataSource Statement Result Set JDBC Application Architecture

20 Creating a Project in java Create a new Project, name it what ever you like. Load JDBC connector in the library of your project. Import java.sql.*; Throw an exception. Call the driver class. Now see next what happens.


Download ppt "In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan."

Similar presentations


Ads by Google