[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;