I am running a web application in the NetBeans 8.0.2 IDE with Glassfish 4.1 that accesses a relational database via the following code:

@Resource( name="jdbc/addressbook" )
DataSource dataSource;

When I run the application I get the following error in the browser:

java.sql.SQLSyntaxErrorException: Table/View 'ADDRESSES' does not exist.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Connection.prepareStatement(Unknown Source)
at com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.java:586)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareCachedStatement(ConnectionWrapper40.java:255)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareCachedStatement(ConnectionWrapper40.java:52)
at com.sun.gjc.spi.ManagedConnectionImpl.prepareCachedStatement(ManagedConnectionImpl.java:992)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareStatement(ConnectionWrapper40.java:173)
at addressbook.AddressBean.getAddresses(AddressBean.java:157)

AddressBean.java line 157 is:
PreparedStatement getAddresses = connection.prepareStatement(
"SELECT FIRSTNAME, LASTNAME, STREET, CITY, STATE, ZIP " +
"FROM ADDRESSES ORDER BY LASTNAME, FIRSTNAME" );

The addressbook database which contains the ADDRESSES table is created via the following steps:

1) Create Connection Pool
a) Right click on Glassfish server and select View Domain Admin Console
b) In the Glassfish web page in Common Tasks on the left column click on JDBC Connection Pools
c) Clicked the New Button and added the following entries:
AddressBookPool for the Name
javax.sql.DataSource for Resource Type
JavaDB for the Database Vendor
d) Click Next and scroll to Additional Properties and specify the following:
Connection Attributes: ;create=true
DatabaseName: addressbook
Password: APP
Click Finish
2) Create Data Source Name
a) In the Glassfish web page in Common Tasks on the left column click on JDBC Resources
b) Click the New Button and specify jdbc/addressbook as the JNDI Name
c) Select AddressBookPool as the Pool name

When I return to the NetBeans Services tab, addressbook has been created under Java DB.

I connect to the database: jdbcerby://localhost:1527/addressbook [APP on APP]

I open a file in NetBeans: addressbook.sql which contains SQL to populate addressbook and run it on the above connection and ADDRESSES table is created and I am able to view the data.

The AddressBook properties has Java DB Driver as a library.