无法将mysql连接到我的tomcat应用程序

时间:2019-06-18 07:04:58

标签: mysql tomcat9

我一直试图将mysql数据库连接到我的tomcat9应用程序。我不知道问题出在哪里?

Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection
("jdbc:mysql://127.0.0.1:3306/abc","root","root");

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using  EditLine wrapper

Connection id:      49
Current database:   
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     5.7.26-0ubuntu0.18.04.1 (Ubuntu)
Protocol version:   10
Connection:     127.0.0.1 via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
TCP port:       3306
Uptime:         23 hours 19 min 46 sec

Threads: 5  Questions: 1043  Slow queries: 0  Opens: 188  Flush tables: 1  Open tables: 181  Queries per second avg: 0.012
--------------

我怎么知道我的tomcat Webapp是否已连接到mysql。

0 个答案:

没有答案