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.

 

@echo off
if "%1A"=="A" goto usage
if "%2A"=="A" goto usage

echo on
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
goto end

:usage
echo usage createDBservice  name dbhome

:end


 

Comments:

Very Cool. Thanks for the tip.

Posted by Shreedhar on October 05, 2007 at 12:22 PM PDT #

Can you tell me how can I start JavaDB as a service without GlassFish? Just the database.

Thanks.

Posted by Marcos on December 13, 2007 at 07:04 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by codeplumber