How to start JavaDB/Derby as a Windows Service
By ByronNevins on Oct 05, 2007
As I've recently started using the built-in Java DB support in GlassFish, I want the Java DB Network Server to start automatically along with GlassFish.
I discovered that I can use the exact same method and program that's used for GlassFish-as-a-service.
On Windows, I used this script to setup a Windows Service that automatically starts the Java DB Network Server. You can change the paths, run it once and the DB will start automatically as a service.
if "%1A"=="A" goto usage
if "%2A"=="A" goto usage
sc create %1 binPath= "C:\\as\\lib\\appservService.exe \\"C:\\as\\bin\\asadmin.bat start-database --dbhome %2\\" \\"C:\\as\\bin\\asadmin.bat stop-database\\"" start= auto DisplayName= %1
echo usage createDBservice name dbhome