jsp页面打开后的问题:java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/pengrenjieDB 我的机器配置:jdk1.6.0_03,NetBeans 6.0
程序代码如下:
<%@ page contentType="text/html; charset=GB2312" language="java" import="java.sql.*,java.util.*;" errorPage=""%>
<html>
<head>
<title>学籍管理系统</title>
</head>
<%! String url,sql; %>
<%! Connection conn;//定义数据库连接对象 %>
<%! ResultSet rs;//定义结果集对象 %>
<%! Statement stmt;//定义SQL语句对象 %>
<%! int i;%>
<body bgcolor="#ffffff">
<div align="center"><font color="#000000" size="5">学籍管理系统 </font> </div>
<table width="75%" border="1" cellspacing="1" cellpadding="1" align="center">
<tr>
<td width=16% align=center>学号</td>
<td width=12% align=center>更改</td>
<td width=12% align=center>删除</td>
</tr>
<%
try{
String url = "jdbc:derby://localhost:1527/pengrenjieDB";
String username = "admin";
String password = "12345678";
Connection conn = DriverManager.getConnection(url,username,password);//建立与数据库的连接
stmt = conn.createStatement();
sql = "select * from AA";
rs = stmt.executeQuery(sql);//查询数据库
while (rs.next()) {
%>
<tr>
<td width=16% align=center><%=rs.getObject(1)%></td>
<td width=12% align=center><a href="change.jsp?xuehao=<%=rs.getObject(1)%>">修改</a></td>
<td width=12% align=center><a href="del.jsp?xuehao=<%=rs.getObject(1)%>">删除</a></td>
</tr>
<%
}
rs.close();
stmt.close();
conn.close();
}catch(Exception e){
out.println(e);
}
%>
</table>
<div align="center"><a href="insert.jsp">添加新记录 </a> </div>
</body>
</html>
程序代码如下:
<%@ page contentType="text/html; charset=GB2312" language="java" import="java.sql.*,java.util.*;" errorPage=""%>
<html>
<head>
<title>学籍管理系统</title>
</head>
<%! String url,sql; %>
<%! Connection conn;//定义数据库连接对象 %>
<%! ResultSet rs;//定义结果集对象 %>
<%! Statement stmt;//定义SQL语句对象 %>
<%! int i;%>
<body bgcolor="#ffffff">
<div align="center"><font color="#000000" size="5">学籍管理系统 </font> </div>
<table width="75%" border="1" cellspacing="1" cellpadding="1" align="center">
<tr>
<td width=16% align=center>学号</td>
<td width=12% align=center>更改</td>
<td width=12% align=center>删除</td>
</tr>
<%
try{
String url = "jdbc:derby://localhost:1527/pengrenjieDB";
String username = "admin";
String password = "12345678";
Connection conn = DriverManager.getConnection(url,username,password);//建立与数据库的连接
stmt = conn.createStatement();
sql = "select * from AA";
rs = stmt.executeQuery(sql);//查询数据库
while (rs.next()) {
%>
<tr>
<td width=16% align=center><%=rs.getObject(1)%></td>
<td width=12% align=center><a href="change.jsp?xuehao=<%=rs.getObject(1)%>">修改</a></td>
<td width=12% align=center><a href="del.jsp?xuehao=<%=rs.getObject(1)%>">删除</a></td>
</tr>
<%
}
rs.close();
stmt.close();
conn.close();
}catch(Exception e){
out.println(e);
}
%>
</table>
<div align="center"><a href="insert.jsp">添加新记录 </a> </div>
</body>
</html>
解决方案 »
- java发送短信 wavecom ,无法使用stopService() 方法
- jstl的问题
- ssh中hibernate的事务管理怎么获得session
- lucene 求解 BooleanQuery$TooManyClaus 谢谢了!!
- 一个JSP与SQL的连接问题,请各位高手指点!
- SSH框架下面怎么用update多条数据
- 小脚本中获得表单的radio按钮的值的函数是什么阿?
- 有关获得数据的小问题??
- Tomcat4.01与Apache1.3.20如何配置,才能正常工作?欢迎讨论!
- 获取表单出现乱码
- 有数组a[n],和数组b[m], n>m, 要求把数组a中的最小值放在
- 如何解决这个错误::java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]无效的描述符索引
你没有对应的jdbc 驱动哦http://db.apache.org/derby/derby_downloads.html
可以用这个驱动.