日期:2014-05-18  浏览次数:20689 次

JSP+SQL连数据库的问题
我的一段用JSP+SQL连数据库的程序,哪位高手帮看看是哪错了
代码如下
<%@   page   contentType= "text/html;charset=gb2312 "%>  
   <%@   page   import= "java.sql.* "%>  
   <html>  
   <body>  
   <%Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ").newInstance();  
  String   url= "jdbc:microsoft:sqlserver://localhost:8080;DatabaseName=master ";  
  //pubs为你的数据库的  
  String   user= "sa ";  
  String   password= "111111 ";  
  
  Connection   conn=   DriverManager.getConnection(url,user,password);  
  Statement   stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);  
  String   sql= "select   *   from   test ";  
  ResultSet   rs=stmt.executeQuery(sql);  
  while(rs.next())   {%>  
  您的第一个字段内容为: <%=rs.getString(1)%>  
  您的第二个字段内容为: <%=rs.getString(2)%>  
   <%}%>  
   <%out.print( "数据库操作成功,恭喜你 ");%>  
 
   </body>  
   </html>  

org.apache.jasper.JasperException:   Unable   to   compile   class   for   JSP

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens

An   error   occurred   at   line:   5   in   the   jsp   file:   /1.jsp
Generated   servlet   error:
Syntax   error   on   tokens,   delete   these   tokens


org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.j