Kwa Kil On Swa

Monday, November 20, 2006

derby network server starup in embeddded mode in a tomcat application

To startup the derby network server you can put
set JAVA_OPTS=-Dderby.drda.startNetworkServer=true
at the top of catalina.bat

or put this code in the top of StartupListener.setupContext()
NetworkServerControl server;

try {
server = new NetworkServerControl();
server.start (null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

or put derby.properties in %TOMCAT_HOME%\bin (which is also where the database created by the embedded derby goes)
# When derby is started in embedded mode by the tomcat web application, this
# flag will cause the network server to start too in another thread.
# This allows other clients such as "ij" to connect to the same database.
derby.drda.startNetworkServer=true
#derby.drda.portNumber=1110
#derby.drda.host=myhost
#derby.connection.requireAuthentication=true
#derby.authentication.provider=BUILTIN
#derby.user.judy=no12see
This is currently my preffered solution.
(Unfortunately its not being picked of the classpath, but from the current directory.)

I think that this directory could be changed by setting derby.system.home, possibly in StartupListener.setupContext(), but I haven't tried it.

0 Comments:

Post a Comment

<< Home