| Accessing Database from JSP |
| |
| Database |
| |
| The database in example consists of a single table of three columns or fields. The database name is "books" and it contains information about books names & authors. |
| |
| Table: books_details |
ID |
Book Name |
Author |
1 |
Java I/O |
Rajaraj Singh |
2 |
Java & XML |
D amrtin |
3 |
Java Swing |
Steav stang |
|
| |
| Start MYSQL prompt and type this SQL statement & press Enter- |
| MYSQL>CREATE DATABASE `books` ; |
| This will create "books" database. |
| |
| Now we create table a table "books_details" in database "books". |
MYSQL>CREATE TABLE `books_details` (
`id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
`book_name` VARCHAR( 100 ) NOT NULL ,
`author` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM ; |
| |
| This will create a table "books_details" in database "books" |
| |
| |
|
| |
| |