oopsht 2006-5-20 17:08
连接一个数据库,老是出错.
<%@ page contentType = "text/html; charset=GB2312" %>
<%@ page import ="java.sql.*" %>
<html>
<head>
<title>数据表一览</title>
</head>
<body>
<%! char sex;%>
<b><center>
<font size=4 color=red>regi 数据库的rgst数据表一览</font><br><hr><br>
<%
Class.forName("sun.jdbc.odbc.jdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:regi");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM rgst");
%>
<table bgcolor=black>
<tr bgcolor="#FFFF00">
<td><b><div><center>姓名</center></div></b></td>
<td><b><div><center>性别</center></div></b></td>
<td><b><div><center>年龄</center></div></b></td>
<td><b><div><center>出生日期</center></div></b></td>
<td><b><div><center>工资</center></div></b></td>
</tr>
<%
while(rs.next())
{
if(rs.getBoolean("性别")) sex='女';
else sex='男';
%>
<tr bgcolor=cyan>
<td><b><div><center><%= rs.getString("姓名")%></center></div></b></td>
<td><b><div><center><%= sex %></center></div></b></td>
<td><b><div><center><%= rs.getInt("年龄")%></center></div></b></td>
<td><b><div><center><%= rs.getDate("出生日期")%></center></div></b></td>
<td><b><div><center><%= rs.getFloat("工资")%></center></div></b></td>
</tr>
<%
}
rs.close();
stmt.close();
con.close();
%>
</table>
</center></b>
</body>
</html>
oopsht 2006-5-20 17:09
500 Servlet Exception
java.lang.ClassNotFoundException: sun.jdbc.odbc.jdbcOdbcDriver
at com.caucho.util.DynamicClassLoader.loadClass(DynamicClassLoader.java:538)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at _sht._regi1__jsp._jspService(/sht/regi1.jsp:13)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:170)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
--------------------------------------------------------------------------------
Resin 2.1.16 (built Tue Feb 15 11:12:27 PST 2005)
winsurfro 2006-6-11 10:53
管理员,能详细点介绍吗?
huijia0805 2008-6-15 21:40
jdbc驱动 配置好没????