| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 676 人关注过本帖
标题:创建access数据库出现问题
只看楼主 加入收藏
yuhua101042
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2012-7-4
结帖率:100%
收藏
 问题点数:0 回复次数:0 
创建access数据库出现问题
下边这段代码:
<%  page    contentType="text/html;  charset=gb2312"   language="java"  import="java.sql.*,*"%>
<html>
<body>
<center>
数据库的删除与创建<br><br>
<table width="200" border="0">
  <tr>
     <td><%
     try
     {
      String sDBDriver ="sun.jdbc.odbc.JdbcOdbcDriver";
      String sConnStr = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=dbaccess.mdb";
      Connection Con= null;
      Statement Stnt = null;
       try
       {
        Class.forName(sDBDriver).newInstance();
       }
        catch(java.lang.ClassNotFoundException e)
        {
         out.print("Connect to Database error: " + e.getMESSAGE());
        }
       try
        {
         Con = DriverManager.getConnection(sConnStr,"sa","");
         }
         catch(SQLException e)
         {
          out.print(e.toString());
         }
         Stmt=Con.createStatement();
         try
         {
          Stmt.execute("drop database tther;");
         }
          catch(SQLException e)
          {
           out.println(e.getMessage());
           }
             Stmt.execute("create database other;");
             Stmt.execute("use other;create table one(t int,t2 varchar(16))");
             Stmt.execute("use other;alter table one add t3 varchar(16) null");
             Stmt.execute("use other;insert into one values(1,'fafa','hehe')");
            out.println("数据库other创建成功");
             Stmt.close();
             Con.close();
            }
          catch(Exception e)
           {
            e.printStachTRACE();
           }
           %></td>
          </tr>
</table>
<center>
</body>
</html>


显示如下错误:
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: 1 in the jsp file: /del_new_db.jsp
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\_\org\apache\jsp\del_005fnew_005fdb_jsp.java:42: ';' expected
  page    contentType="text/html;  charset=gb2312"   language="java"  import="java.sql.*,*"
                                                     ^
1 error



    org.apache.(DefaultErrorHandler.java:84)
    org.apache.(ErrorDispatcher.java:332)
    org.apache.(Compiler.java:412)
    org.apache.(Compiler.java:472)
    org.apache.(Compiler.java:451)
    org.apache.(Compiler.java:439)
    org.apache.jasper.(JspCompilationContext.java:511)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

请问是怎么回事?
搜索更多相关主题的帖子: 数据库 html Microsoft border center 
2012-07-08 20:36
快速回复:创建access数据库出现问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016886 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved