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 James Cowan <co...@freenet.co.uk> on 2005/08/11 11:07:09 UTC

remote connections to embedded derby

Hi

is it possible to make remote connections to an embedded derby database?

James

Re: remote connections to embedded derby

Posted by James Cowan <co...@freenet.co.uk>.
Hi

thanks. I will try this.

James

----- Original Message ----- 
From: "Matt Sanford" <mz...@aol.com>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Thursday, August 11, 2005 2:54 PM
Subject: Re: remote connections to embedded derby


> Hello,
>
>     I have some code currently using the embedded driver with optional
> networking. I put both jars (derby and derbynet) in my classpath and
> then have the following code :
>
>             if (allowNetworkConnections == true) {
>                 log.info("Starting network server in addition to
> embedded.");
>
System.setProperty("derby.drda.startNetworkServer","true");
>                 System.setProperty("derby.drda.host","0.0.0.0");
>             }
>
>     When this is enabled I can use ij on the same host to query the
> in-use database, when it is disabled I cannot. I have not tried it with
> truly remote clients nor tested it very thoroughly, but it worked for my
> purposes.
>
> -- Matt
>
> Oyvind.Bakksjo@Sun.COM wrote:
>
> > Knut Anders Hatlen wrote:
> >
> >> James Cowan <co...@freenet.co.uk> writes:
> >>
> >>
> >>> Hi
> >>>
> >>> is it possible to make remote connections to an embedded derby
> >>> database?
> >>
> >>
> >>
> >> No, you'll have to run the the network server. However, the network
> >> server is just a layer of networking code on top of an embedded derby
> >> database, so in some sense you can say it makes it possible to make
> >> remote connections to an embedded database. But that wasn't what you
> >> had in mind, I guess...
> >
> >
> > Isn't it?
> >
> > http://db.apache.org/derby/docs/10.1/adminguide/cadminovntsrvsample.html
> >
> > Quote:
> >
> > "The embedded driver is loaded when the Network Server is started. The
> > JVM that starts the Network Server can obtain an embedded connection
> > to the same database that the Network Server is accessing to serve
> > clients from other JVMs. This solution provides the performance
> > benefits of the embedded driver and also allows client connections
> > from other JVMs to connect to the same database."
> >
> > To illustrate this in beautiful ascii-art (best viewed with fixed font
> > width):
> >
> > +--------------------------------------+
> > | Client JVM                           |
> > | +------------------------+           |
> > | | Your application logic |           |
> > | +------------+-----------+           |
> > |              |                       |
> > |              V                       |
> > | +----------------------------------+ |
> > | |    Network Client JDBC driver    | |
> > | +-----------------------------+----+ |
> > |                               |      |
> > +-------------------------------|------+
> >                                 |
> > +-------------------------------|------+
> > | Server JVM                    |      |
> > | +------------------------+    |      |
> > | | Your application logic |    |      |
> > | +------------+-----------+    |      |
> > |              |                V      |
> > |              |    +----------------+ |
> > |              V    | Network Server | |
> > | +-----------------+----------+-----+ |
> > | |    Embedded JDBC driver    |     | |
> > | +----------------------------+     | |
> > | |          Derby engine            | |
> > | +----------------------------------+ |
> > +--------------------------------------+
> >
>
> -- 
> When the going gets tough, the weird turn pro.
>   -- Hunter S. Thompson
>


Re: remote connections to embedded derby

Posted by Matt Sanford <mz...@aol.com>.
Hello,

    I have some code currently using the embedded driver with optional 
networking. I put both jars (derby and derbynet) in my classpath and 
then have the following code :

            if (allowNetworkConnections == true) {
                log.info("Starting network server in addition to 
embedded.");
                System.setProperty("derby.drda.startNetworkServer","true");
                System.setProperty("derby.drda.host","0.0.0.0");
            }

    When this is enabled I can use ij on the same host to query the 
in-use database, when it is disabled I cannot. I have not tried it with 
truly remote clients nor tested it very thoroughly, but it worked for my 
purposes.

-- Matt

Oyvind.Bakksjo@Sun.COM wrote:

> Knut Anders Hatlen wrote:
>
>> James Cowan <co...@freenet.co.uk> writes:
>>
>>
>>> Hi
>>>
>>> is it possible to make remote connections to an embedded derby 
>>> database?
>>
>>
>>
>> No, you'll have to run the the network server. However, the network
>> server is just a layer of networking code on top of an embedded derby
>> database, so in some sense you can say it makes it possible to make
>> remote connections to an embedded database. But that wasn't what you
>> had in mind, I guess...
>
>
> Isn't it?
>
> http://db.apache.org/derby/docs/10.1/adminguide/cadminovntsrvsample.html
>
> Quote:
>
> "The embedded driver is loaded when the Network Server is started. The 
> JVM that starts the Network Server can obtain an embedded connection 
> to the same database that the Network Server is accessing to serve 
> clients from other JVMs. This solution provides the performance 
> benefits of the embedded driver and also allows client connections 
> from other JVMs to connect to the same database."
>
> To illustrate this in beautiful ascii-art (best viewed with fixed font 
> width):
>
> +--------------------------------------+
> | Client JVM                           |
> | +------------------------+           |
> | | Your application logic |           |
> | +------------+-----------+           |
> |              |                       |
> |              V                       |
> | +----------------------------------+ |
> | |    Network Client JDBC driver    | |
> | +-----------------------------+----+ |
> |                               |      |
> +-------------------------------|------+
>                                 |
> +-------------------------------|------+
> | Server JVM                    |      |
> | +------------------------+    |      |
> | | Your application logic |    |      |
> | +------------+-----------+    |      |
> |              |                V      |
> |              |    +----------------+ |
> |              V    | Network Server | |
> | +-----------------+----------+-----+ |
> | |    Embedded JDBC driver    |     | |
> | +----------------------------+     | |
> | |          Derby engine            | |
> | +----------------------------------+ |
> +--------------------------------------+
>

-- 
When the going gets tough, the weird turn pro.
  -- Hunter S. Thompson


Re: Distinct subselect bug?

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
Hi,

I browsed the derby user archives and didn't see any responses to your
(very old) article. This is definitely a bug and should be filed in
Jira. I wasn't able to find a Jira issue for this particular bug, so
I'll look into it tomorrow and file an issue if no one points out
something obvious that I have missed.

For the record: I can verify that the reported behaviour also is
present in the latest development version of Derby.

-- 
Knut Anders

Andrew Shuttlewood <an...@futureroute.co.uk> writes:

> While trying out some queries recently, we came across some weird
> issues.
>
> We sometimes work off of queries that are provided by the user, so we
> heavily use subselects. This is a recent one
>
> select distinct(col1) from (select col1,col2,col3,col4 from table) t
>
> Interestingly enough, this doesn't actually work.
>
> I've attached a sample CSV file to demonstrate some sample data.
>
> With this query
>
> select distinct name from (select name,ID from names) n
>
> And a schema of ID:string, Name: String
>
> I get
>
> "Carl"
> "Anna"
> "Julian"
> "Julian"
> "Julian"
> "Andrew"
> "Andrew"
> "Andrew"
> "Ben"
> "George"
> "George"
> "George"
> etc.
>
> if I omit the other column (ie, 'select distinct name from (select name
> from names) n' then it works fine, and it also works okay if I flatten
> the query.
>
> It ALSO works okay if I do an ORDER BY on the top entry. ie
>
> select distinct name from (select name,ID from names) n ORDER BY name
>
> I assume this is a bug?
> names.csv: attached


Re: remote connections to embedded derby

Posted by Oy...@Sun.COM.
Knut Anders Hatlen wrote:
> James Cowan <co...@freenet.co.uk> writes:
> 
> 
>>Hi
>>
>>is it possible to make remote connections to an embedded derby database?
> 
> 
> No, you'll have to run the the network server. However, the network
> server is just a layer of networking code on top of an embedded derby
> database, so in some sense you can say it makes it possible to make
> remote connections to an embedded database. But that wasn't what you
> had in mind, I guess...

Isn't it?

http://db.apache.org/derby/docs/10.1/adminguide/cadminovntsrvsample.html

Quote:

"The embedded driver is loaded when the Network Server is started. The 
JVM that starts the Network Server can obtain an embedded connection to 
the same database that the Network Server is accessing to serve clients 
from other JVMs. This solution provides the performance benefits of the 
embedded driver and also allows client connections from other JVMs to 
connect to the same database."

To illustrate this in beautiful ascii-art (best viewed with fixed font 
width):

+--------------------------------------+
| Client JVM                           |
| +------------------------+           |
| | Your application logic |           |
| +------------+-----------+           |
|              |                       |
|              V                       |
| +----------------------------------+ |
| |    Network Client JDBC driver    | |
| +-----------------------------+----+ |
|                               |      |
+-------------------------------|------+
                                 |
+-------------------------------|------+
| Server JVM                    |      |
| +------------------------+    |      |
| | Your application logic |    |      |
| +------------+-----------+    |      |
|              |                V      |
|              |    +----------------+ |
|              V    | Network Server | |
| +-----------------+----------+-----+ |
| |    Embedded JDBC driver    |     | |
| +----------------------------+     | |
| |          Derby engine            | |
| +----------------------------------+ |
+--------------------------------------+

-- 
Øyvind Bakksjø
Sun Microsystems, Web Services, Database Technology Group
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43419 / +47 73842119, Fax: +47 73842101

Re: remote connections to embedded derby

Posted by James Cowan <co...@freenet.co.uk>.
can the network server be embedded?

>From reading http://db.apache.org/derby/docs/adminguide/cadminov825266.html
it does not look that it can be.

James

----- Original Message ----- 
From: "Knut Anders Hatlen" <Kn...@Sun.COM>
To: "Derby Discussion" <de...@db.apache.org>
Cc: "James Cowan" <co...@freenet.co.uk>
Sent: Thursday, August 11, 2005 10:31 AM
Subject: Re: remote connections to embedded derby


> James Cowan <co...@freenet.co.uk> writes:
>
> > Hi
> >
> > is it possible to make remote connections to an embedded derby database?
>
> No, you'll have to run the the network server. However, the network
> server is just a layer of networking code on top of an embedded derby
> database, so in some sense you can say it makes it possible to make
> remote connections to an embedded database. But that wasn't what you
> had in mind, I guess...
>
> -- 
> Knut Anders
>


Re: remote connections to embedded derby

Posted by Knut Anders Hatlen <Kn...@Sun.COM>.
James Cowan <co...@freenet.co.uk> writes:

> Hi
>
> is it possible to make remote connections to an embedded derby database?

No, you'll have to run the the network server. However, the network
server is just a layer of networking code on top of an embedded derby
database, so in some sense you can say it makes it possible to make
remote connections to an embedded database. But that wasn't what you
had in mind, I guess...

-- 
Knut Anders


Re: remote connections to embedded derby

Posted by James Cowan <co...@freenet.co.uk>.
I want to embed a database in an application and I want other applications
to be able to talk to the database.

For example, openoffice now runs an embedded version of hpersonic/hsqldb but
remote applications can talk to the database. Basically the hypersonic jdbc
driver allows connections from both clients in the same jvm and from remote
clients. Hypersonic has some disadvantages which is why I am looking at
derby instead.

James

----- Original Message ----- 
From: "Shreyas Kaushik" <Sh...@Sun.COM>
To: "Derby Discussion" <de...@db.apache.org>
Sent: Thursday, August 11, 2005 10:37 AM
Subject: Re: remote connections to embedded derby


> Can you eloborate your question a bit more ?
>
> thanks
> Shreyas
>
> James Cowan wrote:
>
> > Hi
> >
> > is it possible to make remote connections to an embedded derby database?
> >
> > James
>


Re: remote connections to embedded derby

Posted by Shreyas Kaushik <Sh...@Sun.COM>.
Can you eloborate your question a bit more ?

thanks
Shreyas

James Cowan wrote:

> Hi
>
> is it possible to make remote connections to an embedded derby database?
>
> James