You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by SML <de...@lafn.org> on 2004/11/10 12:07:58 UTC
Database not found while in Tomcat / jsp
Hello!
I'm trying to integrate a derby db with a jsp page for a school project, and, while I can access the db via the ij tool, all attempts to access the db from within a jsp page have failed. I'm starting tomcat from within Eclipse.
I've googled and googled, but cannot find a solution.
The derby database files are located in the project's WEB-INF/lib directory and the jsp page is located in a directory just under the root.
Many thanks in advance for any help you might be able to offer.
**** the jsp page
<%@ page import="java.sql.*" %>
<%
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
Connection conn = DriverManager.getConnection("jdbc:derby:RecordAppDB;")
Statement s = conn.createStatement();
String sql = "SELECT * FROM tblStudent";
ResultSet rs = s.executeQuery( sql );
rs.close();
s.close();
DriverManager.getConnection("jdbc:derby:;shutdown=true");
%>
***** Error
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Database 'RecordAppDB' not found.
root cause
SQL Exception: Database 'RecordAppDB' not found.
Re: Database not found while in Tomcat / jsp
Posted by Henrique Gomes <li...@farol.co.pt>.
On Nov 10, 2004, at 11:07, SML wrote:
>
> The derby database files are located in the project's WEB-INF/lib
> directory and the jsp page is located in a directory just under the
> root.
>
> Connection conn =
> DriverManager.getConnection("jdbc:derby:RecordAppDB;")
Wy don't you try jdbc:derby:WEB-INF/lib/RecordAppDB ?
I don't think there is any thing magic about the WEB-INF/lib that would
make derby find the database
there auto magically.
If that still doesn't work, you will need to find the absolute path.
---
Henrique Gomes
hmng@farol.co.pt