码迷,mamicode.com
首页 > 数据库 > 详细

tomcat实现连接数据库

时间:2019-05-25 09:24:43      阅读:521      评论:0      收藏:0      [点我收藏+]

标签:character   iad   tomcat7   nba   base   grant   and   exit   商城   

192.168.30.23
mkdir  /web/webapp
tar xf SLSaleSystem.tar.gz -C /web/webapp
ls /web/wenbapp
vim /usr/local/tomcat8/conf/server.xml
<Context docBase="/web/webapp/SLSaleSystem" path="" reloadable="flase" >
        </Context>
/usr/local/tomcat8/bin/shutdown.sh
/usr/local/tomcat8/bin/startup.sh
访问http://192.168.30.23:8080
显示会员商城的后台
连接数据库mariadb
在192.168.30.24上
yum -y intstall mariadb mariadb-server
systemctl start mariadb
mysql

MariaDB [(none)]> create database slsaledb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on slsaledb.* to admin@‘%‘identified by‘123456‘;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye
[root@tomcat~]# rz -E
rz waiting to receive.
[root@tomcat ~]# mysql -uroot < slsaledb-2014-4-10.sql

在192.168.30.23
[root@tomcat ~]# vim /web/webapp/SLSaleSystem/WEB-INF/classes/jdbc.properties
driverClassName=com.mysql.jdbc.Driver
url=jdbc\:mysql\://192.168.30.24\:3306/slsaledb?useUnicode\=true&characterEncoding\=UTF-8
uname=admin
password=123456
minIdle=10
maxIdle=50
initialSize=5
maxActive=100
maxWait=100
removeAbandonedTimeout=180
removeAbandoned=true

[root@tomcat ~]# /usr/local/tomcat7/bin/shutdown.sh


[root@tomcat ~]# /usr/local/tomcat7/bin/startup.sh

访问192.168.30.23:8080




















tomcat实现连接数据库

标签:character   iad   tomcat7   nba   base   grant   and   exit   商城   

原文地址:https://www.cnblogs.com/zc1741845455/p/10921278.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!