mysql连接tomcat - Java / Web 开发
我已经按照教程上配置tomcat的server.xml
<Context path = "/POS" docBase = "POS" debug = "5" reloadable = "true" crossContext = "true" workDir = "">
<Resource name = "jdbc/pos" auth = "Container" type = "javax.sql.DataSource" maxActive = "100" maxIdle ="30" maxWait = "10000"
username = "root" password = "rarzyz" driverClassName = "org.gjt.mm.mysql.Driver" url = "jdbc:mysql:// localhost/test"/>
</Context>
也把教程光盘上的web.xml和appcontext.xml都复制去了。但是还是在按提交登陆的用户名和密码页面后,显示http status 500 The server encountered an internal error () that prevented it from fulfilling this request.
org.hibernate.exception.GenericJDBCException: Cannot open connection
这个不能打开连接提示,是不是提示我的出错了啊。我看过tomcat和mysql服务我都开了。郁闷啊。驱动我也考到lib里面了。实在不知道错误在哪里了
貌似这两个都有问题:
driverClassName = "org.gjt.mm.mysql.Driver" url = "jdbc:mysql:// localhost/test"/>
驱动名不对,url少了端口号。。。
public static String driver="com.mysql.jdbc.Driver"
public static String url="jdbc:mysql://localhost/mydata?user=用户名&password=密码"
可以不要端口号
相关问答:
private static final String URL = "jdbc:oracle:thin:@localhost:1521:orcl";
private static final String USERNAME = "sys";
private static final String PASSWORD = "s ......
想做一个jsp的电子商务网站,想找一些源代码,请问那个网站有好的资源。谢谢!
搜索下吧 开源的也有
csdn就有相似的源码,楼主搜一下
java 开源大全
改模板好麻烦哦,还不如自己写个了呢
jf
顶一 ......
先上错误
无法联接数据库
java.sql.SQLException: Before start of result set
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java: ......