Tomcat
tomcat5中配置mysql数据源:
一、配置环境变量:
<ccid_code></ccid_code>softe version:tomcat5.0.12/mysql4.1.7/mysql_driver--- mysql-connector-java-3.1.4-beta-bin.jar 로그인 후 복사 |
mysql驱动程序可从www.mysql.com官方网站下载
路径:
<ccid_code></ccid_code>tomcat5在d:\myweb\tomcat5; mysql在C:\Program Files\MySQL\MySQL Server 4.1 로그인 후 복사 |
Path(在原来的基础上加上):
<ccid_code></ccid_code>d:\myweb\tomcat5\bin;d:\myweb\jdk1.4;d:\myweb\ jdk1.4\bin; d:\myweb\tomcat5\common\lib\servlet-api.jar;C:\Program Files\ MySQL\MySQL Server4.1\bin CLASSPATH:d:\myweb\tomcat5\common\lib\servlet-api.jar;d:\myweb\ tomcat5\common\lib\jsp-api.jar JAVA_HOME:d:\myweb\jdk1.4 CATALINA_HOME:d:\myweb\tomcat5 로그인 후 복사 |
二、建立测试数据库
在mysql中建立一个forumdb数据库,同时创建一个表member如下:
<ccid_code></ccid_code>create database forumdb; create table member ( id int, name varchar(6) ); 로그인 후 복사 |
然后插入两条测试数据如下:
<ccid_code></ccid_code>insert into member values(1,"zhang"); insert into member values(2,"wang"); 로그인 후 복사 |
至此,数据库准备完毕。