Mybatis + eclipse + MySQL (1)

Source: Internet
Author: User

[1] References

 

Mybatis classic entry instance

 

Mybatis3

 

[2] various tools

Eclipse 3.4.1

JDK 1.6.0 _ 03

Mysql-5.1.50

 

[3] related jar packages

Mybatis-3.0.2.jar

Mysql-connector-java-5.0.5.jar

 

[4] Getting Started (take the mybatis classic getting started instance as a model)

 

1. Install eclipse 3.4.1, JDK 1.6.0 _ 03, mysql-5.1.50

The step is omitted. The default setting is used.

 

2. Create a database and a table and follow the prompts of the instance. Don't forget to enable MySQL server. Enter the MySQL doscommand window through the MySQL command line client, and then enter those scripts.

 

3. Open eclipse, create a new Java project, and obtain the project name. After the project is generated, create a package in the src directory of the project in eclipse,

The name is "com. oryx. mybatis". To do this, right-click SRC and choose new --> package, and enter "com. oryx. mybatis ".

 

4. Put the source code downloaded from the mybatis classic entry instance in the package "com. oryx. mybatis. You can copy it to the resource manager. On the left is the directory structure in eclipse, and on the right is the directory structure of resource manager.

 

5. Pay attention to the following parts in the configuration. xml file:


The username and password attributes must be consistent with those you set when installing mysqlserver. And if you use the specified port,
In this case, you must change 3306 In the attribute URL to your own value.

6. Then add the two jar files to the project. Select "properties" for this project, and add external jars to libraries in Java build path.

Finally, run.


Bytes ----------------------------------------------------------------------------------------------------------------

 

 

 

Private notes:

CREATE TABLE goods (cateId VARCHAR(20), name VARCHAR(20), price double, description VARCHAR(20), orderNo int, updateTime Timestamp);
INSERT INTO goods VALUES ('000001','stock',12.56,'this is a black horse',000001,'2007-10-08 11:53:35');
ALTER TABLE goods ADD id VARCHAR(20);
UPDATE goods SET id = '0' WHERE price = 12.56;

 


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.