|
楼主 |
发表于 2003-6-18 07:26:33
|
显示全部楼层
非常谢谢两位版主,我用psql -h 主机IP -u 你用在JSP中的数据库用户名 -p 数据库名出现如下:
User name: root
Password:
psql: could not connect to server: Connection refused
Is the server running on host 61.237.24.4 and accepting
TCP/IP connections on port vod?
不能连到数据库,但我用netstat -na | grep 3306 能看到端口在监听。
我用./mysql -u root -p
连到mysql后查到我的user表如下:
mysql> select user,password,host from user;
+------+------------------+-----------+
| user | password | host |
+------+------------------+-----------+
| root | 3d9c9bc5012cc6f7 | localhost |
| root | | vod2 |
| | | localhost |
| | | vod2 |
| root | 3d9c9bc5012cc6f7 | % |
| ldzw | 2c7e725b105c9f19 | localhost |
+------+------------------+-----------+
6 rows in set (0.00 sec)
不知还是不是我的user表用户权限问题,还请黄版主看看!
resin和tomcat都是显示如下错误:
java.sql.SQLException: Cannot connect to MySQL server on 61.237.24.4:3306.
Is there a MySQL server running on the machine/port you are trying to connect
to? (java.lang.NumberFormatException)
at com.mysql.jdbc.Connection.connectionInit(Unknown Source)
at com.mysql.jdbc.jdbc2.Connection.connectionInit(Unknown Source)
at com.mysql.jdbc.Driver.connect(Unknown Source)
at com.caucho.sql.XADataSourceAdapter.getXAConnection(XADataSourceAdapter.java:119)
at com.caucho.sql.XADataSourceAdapter.getPooledConnection(XADataSourceAdapter.java:141)
at com.caucho.sql.DBPool.createConnection(DBPool.java:1441)
at com.caucho.sql.DBPool.getPooledConnection(DBPool.java:1334)
at com.caucho.sql.DBPool.getConnection(DBPool.java:1198)
at com.caucho.sql.DBPool.getConnection(DBPool.java:1175)
at _vod._film__jsp._jspService(/vod/film.jsp:14)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:497)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:536) |
|