java.sql.SQLException: Table not found in statement [SELECT custom_field FROM PUBLIC.USER]
here is the code I have
- Code: Select all
<%@ page language="java"
import="java.sql.Connection,
java.sql.DriverManager,
java.sql.ResultSet,
java.sql.Statement" %>
<%!
String title = "Database Test";
String database = "";
String sql = "SELECT KEYWORD FROM USER";
//String sql = "SELECT TABLE_SCHEM, TABLE_NAME FROM INFORMATION_SCHEMA.SYSTEM_TABLES";
//String sql = "SELECT TABLE_NAME AS KEYWORD FROM INFORMATION_SCHEMA.SYSTEM_TABLEPRIVILEGES ";
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
boolean cont = false;
%>
<%
try {
database = "/var/subsonic/db/subsonic.data";
Class.forName("org.hsqldb.jdbcDriver");
connection = DriverManager.getConnection("jdbc:hsqldb:file:" + database, "SA", "");
statement = connection.createStatement();
resultSet = statement.executeQuery(sql);
} catch (Exception e) {
out.print("Unable do make connection database<br />");
out.print(e);
}
%>
<div class="data">
<% while(resultSet.next()){ %>
<p><%= resultSet.getObject("custom_field") %></p>
<% } %>
</div>
<%
resultSet.close();
statement.close();
connection.close();
%>
I left the two other queries I tested in but commented out. The jsp page I'm running this on is a custom page I created and added the the web.xml as a servlet here is my code
- Code: Select all
<servlet>
<servlet-name>customSimple</servlet-name>
<jsp-file>/WEB-INF/jsp/custom/simple.jsp</jsp-file>
<init-param>
<param-name>checkInterval</param-name>
<param-value>1</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>customSimple</servlet-name>
<url-pattern>/simple.get</url-pattern>
</servlet-mapping>
I'm really unsure why it's unable to find tables in PUBLIC, I'm thinking that maybe the /var/subsonic/db/subsonic.data is not the database file. I'm running subsonic 5.2.1 on ubuntu server 14.04.2 any help would be greatly appreciated.