How to use JSP + MySQL to create a message book (1)

Source: Internet
Author: User

(JSP + MySQL database to create a message book, first to create a MySQL database, on the use of MySQL Please download the http://pinghui.51.net/download/012mysql.chm tutorial. Now, for the purpose of illustration, we assume that the database has been created and the database name is pinghui, where the comment table records the message.

The database structure is:
+ ----------- + ------------- + ------ + ----- + --------------------- + ---------------- +
| Field | Type | Null | Key | Default | Extra |
+ ----------- + ------------- + ------ + ----- + --------------------- + ---------------- +
| Userid | int (11) | PRI | 0 | auto_increment |
| Username | char (20) |
| Sex | char (2) |
| Address | char (40) | YES | NULL |
| Ip | char (15) |
| Post | int (11) | YES | 0 |
| Oicq | int (11) | YES | 0 |
| Icq | int (11) | YES | 0 |
| Telnumber | char (30) | YES | NULL |
| Comment | text | NULL |
| Time | datetime | 0000-00-00 00:00:00 |
+ ----------- + ------------- + ------ + ----- + --------------------- + ---------------- +

If you think creating a database is too troublesome
The statement for creating a database is:
Drop database if exists pinghui;
Create database pinghui;
USE pinghui;
Create table comment (
Userid int not null default 0 AUTO_INCREMENT primary key,
Username char (20) not null,
Sex char (2 ),
Address char (40 ),
Ip char (15) not null,
Post int DEFAULT 0,
Oicq int DEFAULT 0,
Icq int DEFAULT 0,
Telnumber char (30 ),
Comment text not null,
Time datetime NOT NULL
);
Insert into comment (username, ip, comment, time) VALUES ("pinghui", "127.0.0.1 ",
"Hello, please go to pinghui free space to view information! ", Now ());
Insert into comment (username, sex, address, ip, post, oicq, icq, telnumber, comment, time)
Values ('pinghui', 'male', 'address', '2017. 0.0.1 ', 127, 74875874, 0531, '2017-8605449 ',
'Hello, please go to pinghui free space to view your message! Thank you! ', Now ());
With the database, our explanation below will be more convenient. Continue to establish the message book

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.