Discussion:
How do I share an Apache derby database to other users?
larsk
2008-01-21 19:38:49 UTC
Permalink
I am trying to create an application (in Java 6.0) that will create and use
an Apache Derby database. I want to make it so other users will be able to
access this database at the same time.
How do I make this possible? What do I need to do on the server application?
What do I need to on the client applications? Is there any guide out there
on how to make this?
If anyone have some information on how to make this work I would really
appreciate some help.
--
View this message in context: http://www.nabble.com/How-do-I-share-an-Apache-derby-database-to-other-users--tp15004715p15004715.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Kristian Waagan
2008-01-21 20:23:03 UTC
Permalink
Post by larsk
I am trying to create an application (in Java 6.0) that will create and use
an Apache Derby database. I want to make it so other users will be able to
access this database at the same time.
How do I make this possible? What do I need to do on the server application?
What do I need to on the client applications? Is there any guide out there
on how to make this?
Hello,

You might find some valuable information here:
http://db.apache.org/derby/papers/DerbyTut/index.html
There is more stuff here: http://wiki.apache.org/db-derby/FrontPage
(look under "Information for Derby users").

Briefy stated, you need to start the Derby network server in your server
application. You have two options;
a) Have your server application connect to a Derby network server as
any other client
b) Start the Derby network server embedded in your server application
Make sure you specify the correct hostname/interface/IP for Derby to
listen on for incoming connections.

For your clients, you need to distribute the client driver
(derbyclient.jar) and then simply connect to the database.
If you need access control, you also have to set this up. Your server
machine must be reachable from the clients.
To connect from the clients, you do something like this:
Connection con =
DriverManager.getConnection("jdbc:derby://your-server-machine:port/databaseName");

I have assumed you want to share the database over the network, but you
can also have your clients connect from localhost. This is the only way
to have multiple JVMs share a single database simultaneously on the same
machine.
Post by larsk
If anyone have some information on how to make this work I would really
appreciate some help.
I suggest you try to get started and then ask for help again. The path
to take from there depends on what you want to do :)


hope this helps,
--
Kristian
Bryan Pendleton
2008-01-21 20:25:09 UTC
Permalink
Post by larsk
I am trying to create an application (in Java 6.0) that will create and use
an Apache Derby database. I want to make it so other users will be able to
access this database at the same time.
Derby includes a Network Server which allows other applications to connect
to the database over the network using client/server JDBC. Here's a good
place to get started reading about this functionality:
http://db.apache.org/derby/docs/10.3/adminguide/cadminov825266.html

thanks,

bryan
Dyre.Tjeldvoll-UdXhSnd/
2008-01-21 20:27:50 UTC
Permalink
Post by larsk
I am trying to create an application (in Java 6.0) that will create and use
an Apache Derby database. I want to make it so other users will be able to
access this database at the same time.
How do I make this possible? What do I need to do on the server application?
What do I need to on the client applications? Is there any guide out there
on how to make this?
If anyone have some information on how to make this work I would really
appreciate some help.
What you need to do really depends on just what you mean with
'users'.

Do you mean to let multiple OS users access the same database
instance? I.e. different processes with different uids? This is possible
but not in embedded mode. You either need to start a NetworkServer, or
start your app with an embedded server. (See the documentation)
Note that you cannot have two jvms accessing the same database.

Or do you mean what you need to do to create users in the database and
authorize them, i.e. CREATE USER, GRANT/REVOKE etc. ?

This is explained in the the manual, but I don't have the exact chapter
and verse.
--
dt
Dyre.Tjeldvoll-UdXhSnd/
2008-01-22 08:09:14 UTC
Permalink
Post by Dyre.Tjeldvoll-UdXhSnd/
Post by larsk
I am trying to create an application (in Java 6.0) that will create and use
an Apache Derby database. I want to make it so other users will be able to
access this database at the same time.
How do I make this possible? What do I need to do on the server application?
What do I need to on the client applications? Is there any guide out there
on how to make this?
If anyone have some information on how to make this work I would really
appreciate some help.
What you need to do really depends on just what you mean with
'users'.
Do you mean to let multiple OS users access the same database
instance? I.e. different processes with different uids? This is possible
but not in embedded mode. You either need to start a NetworkServer, or
start your app with an embedded server. (See the documentation)
Note that you cannot have two jvms accessing the same database.
I must have been tired when I wrote that. It should be

"Note that you cannot have two jvms accessing the same database IN
EMBEDDED MODE"
--
dt
larsk
2008-01-23 16:23:00 UTC
Permalink
Thanks for your answers! I think I know how to solve it know.
I got most of the help from the following page:
http://db.apache.org/derby/docs/10.3/adminguide/cadminov825266.html
Thanks again! :-)
--
View this message in context: http://www.nabble.com/How-do-I-share-an-Apache-derby-database-to-other-users--tp15004715p15045571.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Loading...