求大神帮忙,数据源配了N次了

t736013793 2013-07-24 02:46:29

<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<table border="1" width="40%">
<tr bgcolor="gray">
<th>WET</th>
<th>锟斤拷锟斤拷</th>
<th>锟斤拷锟斤拷</th>
<th>锟皆憋拷</th>
<th>锟斤拷学</th>
<th>锟斤拷锟斤拷</th>
<th>英锟斤拷</th>
</tr>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:JDBC-ODBC ";
Connection con = DriverManager.getConnection(url);
Statement st = con.createStatement();
String sql = "select * from student";
ResultSet rs = st.executeQuery(sql);
while (rs.next()) {
%>
<tr>
<td><%=rs.getInt(1)%></td>
<td><%=rs.getString(2)%></td>
<td><%=rs.getInt(3)%></td>
<td><%=rs.getString(4)%></td>
<td><%=rs.getFloat(5)%></td>
<td><%=rs.getFloat(6)%></td>
<td><%=rs.getFloat(7)%></td>
</tr>
<%
}
rs.close();
st.close();
con.close();
%>
</table>
怎么运行总是提示:
type Exception report

message

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

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC ??????????] δ???????Դ??Ʋ???δָ??Ĭ???????
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:502)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:412)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

javax.servlet.ServletException: java.sql.SQLException: [Microsoft][ODBC ??????????] δ???????Դ??Ʋ???δָ??Ĭ???????
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
org.apache.jsp.chaxun_jsp._jspService(chaxun_jsp.java:128)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.sql.SQLException: [Microsoft][ODBC ??????????] δ???????Դ??Ʋ???δָ??Ĭ???????
sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
java.sql.DriverManager.getConnection(Unknown Source)
org.apache.jsp.chaxun_jsp._jspService(chaxun_jsp.java:82)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


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


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

Apache Tomcat/6.0.35
...全文
194 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
宇宙浪子 2013-07-25
  • 打赏
  • 举报
回复
首先你得先把编码格式改正确吧,编码格式要统一的,这里不详细说了,还有就是你的驱动架包有吗?或者你的数据源配置正确吗?系统的这个数据源个人感觉不给力啊。你的报错内容说明数据库连接是有问题的。我建议你可以使用oracle.jdbc.driver.OracleDriver这个驱动哦,你上面的那个驱动还桥连接呢,没必要的话就不要使用那个了。
u010580980 2013-07-25
  • 打赏
  • 举报
回复
首先:你是用odbc-jdbc桥连接还是jdbc连接 其次:你的连接方式太老了!搜索一个连接数据库的新方法把 最后:如果用桥连接,需要在你的计算机上配置数据源的
聪头 2013-07-25
  • 打赏
  • 举报
回复
乱码给调整一下呗
forgetsam 2013-07-25
  • 打赏
  • 举报
回复
String url = "jdbc:odbc:JDBC-ODBC "; 在你的操作系统中有这个名字的ODBC吗?
xiehui_top 2013-07-24
  • 打赏
  • 举报
回复
驱动类写的都不对 ODBC是什么??????????????
a597926661 2013-07-24
  • 打赏
  • 举报
回复
Connection con = DriverManager.getConnection(url); 这一行 楼主debugger一下看con是不是null Connection con = DriverManager.getConnection(url,"username","password");
S117 2013-07-24
  • 打赏
  • 举报
回复
你没写数据库的用户名和密码吧!
tony4geek 2013-07-24
  • 打赏
  • 举报
回复
大哥 你贴的还乱码了。

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧