db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: How do I share an Apache derby database to other users?
Date Mon, 21 Jan 2008 20:23:03 GMT
larsk skrev:
> 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.

> 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

Mime
View raw message