Download Web Application Development

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

IMDb wikipedia , lookup

Microsoft Access wikipedia , lookup

Oracle Database wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

SQL wikipedia , lookup

Database wikipedia , lookup

Concurrency control wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Relational model wikipedia , lookup

PL/SQL wikipedia , lookup

Database model wikipedia , lookup

Versant Object Database wikipedia , lookup

Clusterpoint wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Transcript
Web Application Development
Muhammad Ali
Versonic Pte
Asher Imtiaz
Forman Christian College

MySQL

MySQL GUI

JDBC

Writing a Student CRUD
Web Application Development
Muhammad Ali
Versonic Pte
Asher Imtiaz
Forman Christian College

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








Roll Number
First Name
Last Name
Gender
Address
Email
Phone
CGPA

Graphical User Interface (GUI) tool for MySQL

Created by Webyog, based in Bangalore,
India.

DEMO with the Implementation
http://en.wikipedia.org/wiki/SQLyog

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

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
Point: Translation to vendor format is performed on the client
• No changes needed to server
• Driver (translator) needed on client
Slide Credit: Programming the World Wide Web Book by Sebesta
JDBC Type
BIT
TINYINT
SMALLINT
INTEGER
BIGINT
REAL
FLOAT
DOUBLE
BINARY
VARBINARY
LONGVARBINARY
CHAR
VARCHAR
LONGVARCHAR
Java Type
boolean
byte
short
int
long
float
double
byte[]
String
JDBC Type
Java Type
NUMERIC
DECIMAL
DATE
TIME
TIMESTAMP
CLOB
BLOB
ARRAY
DISTINCT
STRUCT
REF
BigDecimal
Clob
Blob
Array
mapping of underlying type
Struct
Ref
JAVA_OBJECT
underlying Java class
java.sql.Date
java.sql.Timestamp
Slide Credit: Marty Hall www.coreservlets.com
o) Import Package – java.sql package.
1)
Load the driver
a) Not required in Java 6, so Java 6 needs only 6
steps.
2)
3)
4)
5)
6)
7)
Define the Connection URL
Establish the Connection
Create a Statement object
Execute a query
Process the results
Close the connection
Slide Credit: Marty Hall www.coreservlets.com
3
1
Driver Manager
creates
Connection
creates
2
Establish Link
To DB
6
Statement
SQL
creates
ResultSet
4
Data
5
Driver
Database
Slide Credit: Umair Javed, LUMS

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
// 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();