我在Windows上使用Netbeans 8.0.2。我编写了一个示例JSP页面
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h2>Hello, World!</h2>
<sql:query var="allRows" dataSource="jdbc/sample">
SELECT name, city, state FROM APP.customer
</sql:query>
<table border="1">
<thead>
<tr>
<th>Name</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<c:forEach var="currentRow" items="${allRows.rows}">
<tr>
<td>"${currentRow.name}"</td>
<td>"${currentRow.city}", "${currentRow.state}"</td>
</tr>
</c:forEach>
</tbody>
</table>
</body>
</html>但是如果我执行这个页面
javax.servlet.ServletException:
SELECT name, city, state FROM APP.customer
: Table/view 'APP.CUSTOMER' is not exist.示例数据库是一个演示Derby数据库。我使用GlassFish服务器4.1、JDK 7、Java 7,所有这些都在默认的Netbeans安装中。我使用GlassFish服务器的默认设置。
我在Services选项卡上看到了示例数据库连接。它是jdbc:derby://localhost:1527/sample。我在SamplePool连接池属性GlassFish中看到了这个url。此连接池用于JDBC /示例JDBC资源。样本数据库中存在APP.CUSTOMER表。
我做错什么了?
发布于 2015-02-17 20:35:25
我不知道出了什么问题,但请尝试以下几点:
glassfish4/javadb/lib复制到glassfish4/glassfish/lib/endorsed要使用基本示例,这应该足够了,但是您可能不想在生产中使用它。
https://stackoverflow.com/questions/28568478
复制相似问题