You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Ole Ersoy <ol...@gmail.com> on 2008/11/06 15:28:38 UTC

Embedded and Network Simultaneous Connections

Hi,

I was wondering if it's possible for a network client to connect to a derby instance running in embedded mode.  So in other words client A is running embedded derby, and (client B - Separate JVM) wants to connect to it using the network driver.

Thanks,
- Ole


Re: Embedded and Network Simultaneous Connections

Posted by Ole Ersoy <ol...@gmail.com>.
Hi Everyone,

Thanks (Tusen Takk) you so much for all the helpful links and advice.  My application uses Derby embedded to avoid the network latency, but having a peak at what's happening from my IDE (Outside of unit tests) is helpful, so this is perfect.

Thanks again,
- Ole



Kathey Marsden wrote:
> Ole Ersoy wrote:
>> Hi,
>>
>> I was wondering if it's possible for a network client to connect to a 
>> derby instance running in embedded mode. 
> Please take a look at this example and see if it is what you need:
> http://db.apache.org/derby/docs/10.4/adminguide/radminembeddedserverex.html
> 
> An easier way to start network server in the same jvm as your embedded 
> application is with the derby.drda.startNetworkServer  property.
> http://db.apache.org/derby/docs/10.4/adminguide/radminconfigstartnetworkserver.html 
> 
> 
> 
> Kathey
> 
> 
> 

Re: Embedded and Network Simultaneous Connections

Posted by Kathey Marsden <km...@sbcglobal.net>.
Ole Ersoy wrote:
> Hi,
>
> I was wondering if it's possible for a network client to connect to a 
> derby instance running in embedded mode. 
Please take a look at this example and see if it is what you need:
http://db.apache.org/derby/docs/10.4/adminguide/radminembeddedserverex.html

An easier way to start network server in the same jvm as your embedded 
application is with the derby.drda.startNetworkServer  property.
http://db.apache.org/derby/docs/10.4/adminguide/radminconfigstartnetworkserver.html


Kathey



Re: Embedded and Network Simultaneous Connections

Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
It is no problem having an application with an embedded Derby and
starting the Derby network server so that network clients may connect
to the same database:

You may e.g  start your embedded app like this:

java -Dderby.drda.startNetworkServer=true
 -Dderby.drda.host=ahost
  -Dderby.drda.port=12345
  -classpath derbynet.jar ...

Or do the following in your app:

NetworkServerControl server = new NetworkServerControl
           (InetAddress.getByName(“ahost”), 12345);
server.start(null);



-- 
Bernt Marius Johnsen, Staff Engineer
Database Technology Group, Sun Microsystems, Trondheim, Norway

Re: Embedded and Network Simultaneous Connections

Posted by Kristian Waagan <Kr...@Sun.COM>.
Ole Ersoy wrote:
> Hi Michael,
>
> Thanks for the clarification.  That answers my question.

Hello Ole,

Please note that you can have your application use the embedded driver, 
and also start the the network server so that remote clients can connect 
to the same Derby instance.
I don't remember the details (please look at the documentation or wait 
for an answer), but I think you can set a property or start it though a 
Java API.

One scenario for this setup, is having your main application use Derby 
embedded and then connect remotely for "ad-hoc" access/maintenance or 
connection secondary clients.
Of course, opening up for remote connections has security implications. 
A white paper on security with Derby has been published on the Sun 
Developer Network site.


regards,
-- 
Kristian
>
> Thanks again,
> - Ole
>
>
>
> derby@segel.com wrote:
>>
>>> -----Original Message-----
>>> From: Ole Ersoy [mailto:ole.ersoy@gmail.com]
>>> Sent: Thursday, November 06, 2008 8:29 AM
>>> To: derby-user@db.apache.org
>>> Subject: Embedded and Network Simultaneous Connections
>>>
>>> Hi,
>>>
>>> I was wondering if it's possible for a network client to connect to a
>>> derby instance running in embedded mode.  So in other words client A is
>>> running embedded derby, and (client B - Separate JVM) wants to 
>>> connect to
>>> it using the network driver.
>>>
>>> Thanks,
>>> - Ole
>>
>> I don't think your question make sense.
>> If you're running Derby in embedded mode, then you don't have a 
>> "client",
>> you have an application which has a derby database embedded in it.
>>
>> So I think your question becomes "Application A has derby embedded in 
>> it. A
>> separate application B, on a different JVM, would like to connect to the
>> Derby instance running in A."
>>
>> Since you specified that the instance of Derby is embedded there is no
>> network service started and thus you can't connect to that instance 
>> of Derby
>> unless you write your own service as part of application A.
>>
>>
>>
>>
>>


Re: Embedded and Network Simultaneous Connections

Posted by Rick Hillegas <Ri...@Sun.COM>.
Note that it's possible for application A to startup the network server 
in a separate thread. That is, application A and the network server 
could run in the same VM. In this scenario, Ole gets what he wants. For 
more information on this, please see the section titled "Starting the 
Network Server from a Java application" in the Derby Admin Guide: 
http://db.apache.org/derby/docs/10.4/adminguide/

Hope this helps,
-Rick

Ole Ersoy wrote:
> Hi Michael,
>
> Thanks for the clarification.  That answers my question.
>
> Thanks again,
> - Ole
>
>
>
> derby@segel.com wrote:
>>
>>> -----Original Message-----
>>> From: Ole Ersoy [mailto:ole.ersoy@gmail.com]
>>> Sent: Thursday, November 06, 2008 8:29 AM
>>> To: derby-user@db.apache.org
>>> Subject: Embedded and Network Simultaneous Connections
>>>
>>> Hi,
>>>
>>> I was wondering if it's possible for a network client to connect to a
>>> derby instance running in embedded mode.  So in other words client A is
>>> running embedded derby, and (client B - Separate JVM) wants to 
>>> connect to
>>> it using the network driver.
>>>
>>> Thanks,
>>> - Ole
>>
>> I don't think your question make sense.
>> If you're running Derby in embedded mode, then you don't have a 
>> "client",
>> you have an application which has a derby database embedded in it.
>>
>> So I think your question becomes "Application A has derby embedded in 
>> it. A
>> separate application B, on a different JVM, would like to connect to the
>> Derby instance running in A."
>>
>> Since you specified that the instance of Derby is embedded there is no
>> network service started and thus you can't connect to that instance 
>> of Derby
>> unless you write your own service as part of application A.
>>
>>
>>
>>
>>


Re: Embedded and Network Simultaneous Connections

Posted by Ole Ersoy <ol...@gmail.com>.
Hi Michael,

Thanks for the clarification.  That answers my question.

Thanks again,
- Ole



derby@segel.com wrote:
> 
>> -----Original Message-----
>> From: Ole Ersoy [mailto:ole.ersoy@gmail.com]
>> Sent: Thursday, November 06, 2008 8:29 AM
>> To: derby-user@db.apache.org
>> Subject: Embedded and Network Simultaneous Connections
>>
>> Hi,
>>
>> I was wondering if it's possible for a network client to connect to a
>> derby instance running in embedded mode.  So in other words client A is
>> running embedded derby, and (client B - Separate JVM) wants to connect to
>> it using the network driver.
>>
>> Thanks,
>> - Ole
> 
> I don't think your question make sense.
> If you're running Derby in embedded mode, then you don't have a "client",
> you have an application which has a derby database embedded in it.
> 
> So I think your question becomes "Application A has derby embedded in it. A
> separate application B, on a different JVM, would like to connect to the
> Derby instance running in A."
> 
> Since you specified that the instance of Derby is embedded there is no
> network service started and thus you can't connect to that instance of Derby
> unless you write your own service as part of application A.
> 
> 
> 
> 
> 

RE: Embedded and Network Simultaneous Connections

Posted by de...@segel.com.

> -----Original Message-----
> From: Ole Ersoy [mailto:ole.ersoy@gmail.com]
> Sent: Thursday, November 06, 2008 8:29 AM
> To: derby-user@db.apache.org
> Subject: Embedded and Network Simultaneous Connections
> 
> Hi,
> 
> I was wondering if it's possible for a network client to connect to a
> derby instance running in embedded mode.  So in other words client A is
> running embedded derby, and (client B - Separate JVM) wants to connect to
> it using the network driver.
> 
> Thanks,
> - Ole

I don't think your question make sense.
If you're running Derby in embedded mode, then you don't have a "client",
you have an application which has a derby database embedded in it.

So I think your question becomes "Application A has derby embedded in it. A
separate application B, on a different JVM, would like to connect to the
Derby instance running in A."

Since you specified that the instance of Derby is embedded there is no
network service started and thus you can't connect to that instance of Derby
unless you write your own service as part of application A.