users@glassfish.java.net

Re: Java DB problem

From: Bobby Bissett <Robert.Bissett_at_Sun.COM>
Date: Thu, 03 Apr 2008 16:04:23 -0400

> I created web application using NetBeans and Visual Web JSF
> framework. I created database and tables using NetBeans in JavaDB
> Network (Derby). When I use green arrow, NetBeans runs Glassfish and
> Derby, deploys application and everything works fine. The problem
> is, where I want to run my project without NetBeans. I run NetBeans:
> asadmin start-domain domain1. My application works, but it's unable
> to use database. When I tried to run database: asadmin start-
> database it don't resolve my problem. Maybe because I use network
> database and "start_database" uses embedded? I don't know what
> should I do to run my application with database. Any ideas?

I can't tell if you have a connection issue or tables not found or
something else. Just in case it's an issue with your data not being
found:

It may be an issue with the location of where your table data is
stored. When you run "asadmin start-database" it starts up Derby and
uses glassfish/databases to store everything. This is because you
haven't specified a location for where the tables should be stored.
NetBeans by default uses a different location (which is probably the
right thing, but most of us don't want to type that much on the
command line).

To make the command line and NetBeans use the same location, edit the
properties for the "Java DB" database in NetBeans to use:

Java DB Installation: <some path>/glassfish/javadb (this one is
probably the default)
Database Location: <same path>/glassfish/databases

...or see what location it's already using (for instance,
$HOME/.netbeans-derby) and use this when you start the database from
the command line. I think the format is:

asadmin start-database --dbhome <path to directory>

Cheers,
Bobby