Home > Database > Mysql Tutorial > servlet用javabean连接访问mysql失败

servlet用javabean连接访问mysql失败

WBOY
Release: 2016-06-06 09:44:05
Original
1368 people have browsed it

mysqlservletjavabeanmvc

如果用java application连接wamp的mysql的话可以访问,但是换成servlet来访问就失败了
导入驱动包了,也把驱动包放入tomcat了,也改了mysql里面的服务时间了。
用php的话可以成功访问。
错误信息:
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:343)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2132)
... 66 more
........
.........
后面省略

查了好多方法,都没用,求各位帮个忙啊

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template