0

I am trying to load the derby sample database on my machine through NetBeans and populate a table. Unfortunately I am getting an error about userid or password being invalid. This is the default derpy sample database and i an unable to find out where a username and password could be located.

The index file:

<%@page import="webstoreUtils.*,java.sql.*,org.apache.derby.jdbc.*"%>
<%@ include file="admin/connection.jsp" %> 
<%ResultSet rs = stmt.executeQuery("select * from APP.PRODUCT"); %>
<%= WebstoreUtils.getHeader("Welcome to Comp-orium!") %>
<h2>Welcome to Comp-orium</h2> 
<h4>Daily Steal</h4> 
<%= WebstoreUtils.getNavigation() %> 
<p>Click a Title to view more information</p> 
<%= WebstoreUtils.getTable(rs,0,true,2,1,"details.jsp") %> 
<%= WebstoreUtils.getFooter() %> 
<%@ include file="admin/close.jsp" %>

The Connection file

<%
String dbURI = "jdbc:derby://localhost:1527/sample";
DriverManager.registerDriver(new ClientDriver());
Connection con = DriverManager.getConnection(dbURI);
Statement stmt = con.createStatement();
%>

Webstore Utils is a class that simply returns html script to the page.

BillRobertson42
  • 12,602
  • 4
  • 40
  • 57
David Moran
  • 177
  • 2
  • 12
  • 1
    you would normally pass username/password to the getConnection method. – jalynn2 Dec 10 '13 at 15:43
  • Do not use java inside jsp. Have a look at http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files/3180202#3180202 – Makky Dec 10 '13 at 15:59

0 Answers0