JSP连接数据源的问题
系统是win2003的,JDK1.5,数据库是sqlserver2000,tomcat5.5
JSP运行的时候报错如下:
The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: [Microsoft][ODBC 驱动程序管理器]
未发现数据源名称并且未指定默认驱动程序 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:135)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
数据源名称没问题啊,我用的是JDBC-ODBC桥接,是否还需要下载JDBC驱动呢?还望各位高手指教!谢谢了!
程序主要部分如下:
Connection con=DriverManager.getConnection( "jdbc:odbc:sim ", " ", " ");
try
{
Statement sql=con.createStatement();
}
catch(
SQLException e)
{}
//Connection con;
Statement sql;
ResultSet rs;
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(
ClassNotFoundException e)
{}
try
{
con=DriverManager.getConnection( "jdbc:odbc:sim ", " ", " "); //得到与数据库的连接
sql=con.createStatement();
rs=sql.executeQuery( "SELECT * FROM sim_table ");
out.print( " <table border> ");
out.print( " <tr> ");
out.print( " <th width=100> "+ "卡号 "