servlet用javabean连接访问mysql失败
如果用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
........
.........
后面省略
查了好多方法,都没用,求各位帮个忙啊
上一篇: java什么时间好找工作
下一篇: java中num是什么意思