Download presentation
Presentation is loading. Please wait.
Published byMarian Barton Modified over 9 years ago
1
Web Application Development Muhammad Ali Versonic Pte Asher Imtiaz Forman Christian College
2
MySQL MySQL GUI JDBC Writing a Student CRUD
3
Web Application Development Muhammad Ali Versonic Pte Asher Imtiaz Forman Christian College
4
Full-featured Database Management System Most popular for Web applications Over 6 million installations Over 20 OS are supported Libraries for accessing MySQL are available in all major programming languages Used in high scale WWW products including Google, Wikipedia and Facebook http://en.wikipedia.org/wiki/MySQL
5
Roll Number First Name Last Name Gender Address Email Phone CGPA
6
Graphical User Interface (GUI) tool for MySQL Created by Webyog, based in Bangalore, India. DEMO with the Implementation http://en.wikipedia.org/wiki/SQLyog
7
An API for Java programming language Define how a client may access a DB Provides methods for querying and updating data in a DB http://en.wikipedia.org/wiki/Java_Database_Connectivity
8
JDBC is a ‘standard’ API programmers use to access database systems Various JDBC drivers are available that interface with particular database systems A few database systems (HSQLDB and Derby) use JDBC as their native API
9
Slide Credit: Programming the World Wide Web Book by Sebesta Point: Translation to vendor format is performed on the client No changes needed to server Driver (translator) needed on client
10
JDBC TypeJava Type BIT boolean TINYINT byte SMALLINT short INTEGER int BIGINT long REAL float FLOAT double DOUBLE BINARY byte[] VARBINARY LONGVARBINARY CHAR String VARCHAR LONGVARCHAR JDBC TypeJava Type NUMERIC BigDecimal DECIMAL DATE java.sql.Date TIME java.sql.Timestamp TIMESTAMP CLOB Clob BLOB Blob ARRAY Array DISTINCT mapping of underlying type STRUCT Struct REF Ref JAVA_OBJECT underlying Java class Slide Credit: Marty Hall www.coreservlets.com
11
o ) Import Package – java.sql package. 1) Load the driver a) Not required in Java 6, so Java 6 needs only 6 steps. 2) Define the Connection URL 3) Establish the Connection 4) Create a Statement object 5) Execute a query 6) Process the results 7) Close the connection Slide Credit: Marty Hall www.coreservlets.com
12
Driver Manager Connection creates Statement ResultSet creates Driver Database SQL Data Establish Link To DB 1 2 3 4 5 6 Slide Credit: Umair Javed, LUMS
13
The database connection URL is specified by a string of the form jdbc:subprotocol_name:more_info The subprotocol name is mysql for MySQL other_info might include the database name and a query string providing values such as a username or password
14
// Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306", "root", "abc"); Statement statement = connection.createStatement(); int rowCount = statement.executeUpdate(“INSERT INTO sams_student(std_roll_number, std_name) VALUES(‘11-10307’, ‘Ahmed’)”); connection.close();
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.