How to use Jsp+mysql to create a message (i) _JSP programming

Source: Internet
Author: User
Tags datetime
Note: Use Jsp+mysql database to create a message book, first to create a MySQL database, about the use of MySQL to http://pinghui.51.net/download/012mysql.chm download tutorial. Now in order to illustrate the need, we assume that the database has been established, the name of the database is Pinghui, where the comment table is recorded message information.

The structure of the database 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 it's too much trouble to build a database,
The statement that establishes the 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 (not NULL),
Sex char (2),
Address char (40),
IP char not NULL,
Post int DEFAULT 0,
OICQ int DEFAULT 0,
ICQ int DEFAULT 0,
Telnumber Char (30),
Comment Text not NULL,
Time datetime is not NULL
);
INSERT into comment (username,ip,comment,time) VALUES ("Pinghui", "127.0.0.1",
"Hello, please go to ping hui free space to view information!" ", now ());
Insert into comment (username,sex,address,ip,post,oicq,icq,telnumber,comment,time)
VALUES (' Pinghui ', ' Men ', ' address ', ' 127.0.0.1 ', 250100,2269101,74875874, ' 0531-8605449 ',
' Hello, please go to ping hui free space to view the message! Thank you! ', now ());
With the database below our explanation will be more convenient. Continue the establishment of 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.