db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: About Exception while Using NetworkServerControl API in Java Code
Date Fri, 30 Apr 2010 15:06:46 GMT
On 30.04.10 16:47, Dusane, Sachin wrote:
>
> Hi ,
>
> I am trying to explore the Java DB locally so, I tried using the 
> NetworkServerControl API in my java code and tried to start the java 
> db locally using the below lines as shown in reference.
>
> But when I run the application it is giving me following exception
>
> Could not connect to Derby Network Server on host localhost, port 
> 1527: Connection refused: connect
>
> You can use the NetworkServerControl API to start the Network Server 
> from a separate thread within a Java application:
>
> NetworkServerControl server = new NetworkServerControl();
>
> server.start (null);
>
> What is cause of this problem? Thanks for your help in advance.
>

Hi,

Are you connecting from the local host, or from a remote host?
By default, the Derby server will only allow connections from the local 
host.

On the command line you would specify the -h argument (possibly using 
0.0.0.0 for all interfaces on the machine), programatically I think you 
would pass an InetAddress to NetworkServerControl.
Just remember to use something else than "localhost" :) I think you can 
also specify a Java system property, see the manual(s) for more details.

If you are connecting from the local host, can you use something like 
netstat to confirm that Derby is listening to the port?

BTW; Normally the user list has a better suited audience for this kind 
of question. See [1] for mailing list instructions.


Hope this helps,
-- 
Kristian

[1] http://db.apache.org/derby/derby_mail.html

> Regards,
>
> Sachin Dusane
>
> Confidential: This electronic message and all contents contain 
> information from Syntel, Inc. which may be privileged, confidential or 
> otherwise protected from disclosure. The information is intended to be 
> for the addressee only. If you are not the addressee, any disclosure, 
> copy, distribution or use of the contents of this message is 
> prohibited. If you have received this electronic message in error, 
> please notify the sender immediately and destroy the original message 
> and all copies.


Mime
View raw message