您的位置:首页 > 产品设计 > 产品经理

安装MySQL数据库的图形管理界面jspmyadmin过程遇到的问题及解决方法

2010-06-22 21:52 1291 查看
 

在使用MySQL数据库时,我用的是jspmyadmin的图形管理界面来管理该数据库,我的
步骤是:
第一步:下载jspmyadmin,网址:http://sourceforge.net/projects/jspmyadmin/
页面
 
第二步:将下载的jspmyadmin压缩文件(jspmyadmin0.6.zip)解压后,将该文件夹
全部复制到网站服务器Tomcat的Webapps目录下,因此它的路径为D:/Tomcat 6.0
/webapps/jspmyadmin
 
第三步:经过上面的设置后,如果在IE浏览器的地址栏中输入 http://localhost:8080/jspmyadmin/,则会发现jspmyadmin管理接口无法正常显示, 这是因为还没有修改jspmyadmin数据库状态设置文件config.inc.jsp,由于Mysql数据
库默认的连接端口是3306,因此打开jspmyadmin文件夹下的config.inc.jsp文件后修
改第13行的程序代码port=3306。
 
第四步:但此时重新在地址栏中输入http://localhost:8080/jspmyadmin/,又会出现
http status 500的错误,页面出现的代码为:
HTTP Status 500 -
 
-----------------------------------------------------
 
type Exception report
 
message
 
description The server encountered an internal error () that prevented it
from fulfilling this request.
 
exception
 
org.apache.jasper.JasperException: Unable to compile class for JSP:
 
An error occurred at line: 43 in the jsp file: /lib.inc.jsp
Enumeration cannot be resolved
40: pageContext.setAttribute(PROPERTIES_REQUEST_KEY,myproperties,
pageContext.SESSION_SCOPE);
41: }
42: Hashtable all = new Hashtable();
43: Enumeration enum = myproperties.propertyNames();
44:    while (enum.hasMoreElements()) {
45:          String key= (String)enum.nextElement();
46:          String value= myproperties.getProperty( key );
 
 
An error occurred at line: 44 in the jsp file: /lib.inc.jsp
Syntax error on token "enum", invalid expression_r_r
41: }
42: Hashtable all = new Hashtable();
43: Enumeration enum = myproperties.propertyNames();
44:    while (enum.hasMoreElements()) {
45:          String key= (String)enum.nextElement();
46:          String value= myproperties.getProperty( key );
47:          all.put( key, value );
 
 
An error occurred at line: 45 in the jsp file: /lib.inc.jsp
Syntax error on token "enum", delete this token
42: Hashtable all = new Hashtable();
43: Enumeration enum = myproperties.propertyNames();
44:    while (enum.hasMoreElements()) {
45:          String key= (String)enum.nextElement();
46:          String value= myproperties.getProperty( key );
47:          all.put( key, value );
48:    }
 
 
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError
(DefaultErrorHandler.java:93)
org.apache.jasper.compiler.ErrorDispatcher.javacError
(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:4
a6e1
35)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:277)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:265)
org.apache.jasper.JspCompilationContext.compile
(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service
(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 
note The full stack trace of the root cause is available in the Apache
Tomcat/6.0.20 logs.
该问题的解决方法为:修改第lib.inc.jsp文件的43行:Enumeration enum =
myproperties.propertyNames(); 中的enum改为enum_new,下面几行中也有几处enum
,一并修改,注意不要改错了,只修改enum变量为enum_new;这主要是因为新版本的
Jspmyadmin中enum已经变成关键字了,所以enum不能作为变量名,这里就是发生了变量名与关键字的冲突。
 
第五步:就在我们觉得快大功告成的时候,又出现了新的问题。同样我们在地址栏中输入访问的地址,打开的网页显示的代码如下:
Oops! an exception occurred.
The exception was: java.sql.SQLException: Invalid authorization specification: Access denied for user 'root'@'localhost' (using password: NO)
The exception class was : class java.sql.SQLException
 
我原来的解决方法是打开jspmyadmin文件夹下的config.inc.jsp文件,修改password=“我实际用的数据库的密码”,但是又出现新的问题:
Oops! an exception occurred.
The exception was: java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
The exception class was : class java.sql.SQLException
 
所以我个人认为jspmyadmin管理Mysql数据库,该数据库的密码必须改为空,以下为修改数据库密码的代码:
mysql->use mysql;
mysql->update mysql.use set password = password(‘’) where user=’root’;
mysql->flush privileges;
mysql->quit
 
这下在输入访问地址,成功的进入jspmyadmin 管理界面。
 
补充:修改jspmyadmin中文编码
打开Tomcat服务器的jspmyadmin 文件夹,找到其中的lib.inc.jsp文件并打开该文件.在第17行加上程序代码如下:contentType=”text/html;charset = gb2312”,也就是将第17行改成如下的程序代码:
<%@ page contentType=”text/html;charset=gb2312” language=”java” import=”java.text.*,java.sql.*,java.util.*,java.io.*,java.net.*,com.jspmyadmin,*” errorPage=”error..jsp”   %>
在第21行按下Enter键空出一行,并加上如下程序代码:
Request,setCharacterEncoding(“gb2312”);
这样在jspmyadmin管理界面中输入中文字,中文字可以正常显示了。
 
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐