db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: How to start derby netserver within an application
Date Mon, 29 Aug 2005 17:53:32 GMT
Hi Kostas,

The following change to your ant script might accomplish what you intend 
when you say you want to start Derby in another directory:

<target name="runCacheDB" description="Start Database">
        <java fork="true" 
classname="org.apache.derby.drda.NetworkServerControl" dir="db" 
classpath="${derby.classpath}">
            <arg value="start"/>
            <arg value="-h"/>
            <arg value="${db.host}"/>
            <arg value="-p"/>
            <arg value="${db.port}"/>

            <sysproperty key="derby.system.home" 
value="${yourPreferredStartupDirectory}"/>

        </java>
</target>

Cheers,
-Rick

Kostas Karadamoglou wrote:

> Hello all,
>
> I am developing an applicaiton that uses Derby 10.1.1. Since now I 
> start the database indepedently from the main application. I use ant 
> to invoke the derby net server. Here is one of my targets:
>
> <target name="runCacheDB" description="Start Database">
>         <java fork="true" 
> classname="org.apache.derby.drda.NetworkServerControl" dir="db" 
> classpath="${derby.classpath}">
>             <arg value="start"/>
>             <arg value="-h"/>
>             <arg value="${db.host}"/>
>             <arg value="-p"/>
>             <arg value="${db.port}"/>
>         </java>
> </target>
>
> I am planning to embedd the startup of the database network server 
> within the application. I found some references of doing that in 
> 10.1.1 manual. Here is a sample code:
>
> NetworkServerControl server = new 
> NetworkServerControl(InetAddress.getByName("localhost"),1528);
>             server.start(new PrintWriter(System.out));
>
> The code works fine. but I have two major problems. I would like to 
> start the database in a different directory than the current working 
> directory. For instance in a subdirectory called "db".
>
> How can I specify this? Which is the best option?
>
> The second problem is that I dont receive ouput messages at the 
> System.out.
>
> Do you know if the start method is used correcly.
>
> Thank you in advance, Kostas.
>


Mime
View raw message