回 帖 发 新 帖 刷新版面

主题:jsp连接sql server

我的问题是: 
HTTP Status 500 - 

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

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect.  Invalid URL.
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
    org.apache.jsp.ch1.shujuku_jsp._jspService(shujuku_jsp.java:113)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    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)


root cause 

java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unable to connect.  Invalid URL.
    com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
    com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
    com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
    java.sql.DriverManager.getConnection(DriverManager.java:512)
    java.sql.DriverManager.getConnection(DriverManager.java:171)
    org.apache.jsp.ch1.shujuku_jsp._jspService(shujuku_jsp.java:61)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    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

帮帮我啊

回复列表 (共2个回复)

沙发

代码呢?
那个连结池配置对了吗?

板凳

Jsp连接sqlserver大概是这样的:
<%@page language="java" import="java.sql.*;"%>
try
{
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   Connection con=DriverManager.getConnection("jdbc:odbc:数据库名","用户名","密码");
   PreparedStatement s=con.pripareStatement("查询语句(可以是其他语句)");
   不同的语句下面有不同的变化,你可以发个题目给我,我可以教你怎么做

}
catch(java.sql.SQLException sqle)
{

}

我来回复

您尚未登录,请登录后再回复。点此登录或注册