Bill Shannon wrote:
I'm trying to use derby and I'm having a terrible time navigating
the documentation.  I can't find simple answers to things that I
think should be simple.  Can someone point me in the right direction?

Bill,

I agree that the documentation is difficult to navigate in. An common index for all manuals would have helped a lot. Now, it is not always clear which manual to look in. I often end up using Google to search the manuals. If I add "site:db.apache.org/derby/docs/10.2" to my Google search criteria, I will only search the 10.2 manuals.


Here's what I want to do...

I want to start the server as a network server and allow connections
from other machines.

This is described in the "Derby Server and Administration Guide". The section "Starting the Network Server" describes how to start the server. The description of how to do this has been updated lately, and I think the development versions of the manuals (http://db.apache.org/derby/docs/dev/adminguide) describes this better than the 10.2 manuals.

There are basically three ways to start the server:
- Use the scripts in the bin directory
- java -jar derbyrun.jar server start
- java java org.apache.derby.drda.NetworkServerControl start

The same section also describes how to open up for connections from other machines (-h option). The default is to only listen on the localhost network interface.


I want to configure a username and password for connecting to the server.

User name handling in Derby is a bit different from most other databases. See "Working with user authentication" in the "Developer's Guide". Derby provides pluggable user authentication (e.g., you can use and LDAP server to authenticate users). For a description of how to use the built-in user repository, see "Built-in Derby users" in the same manual. Basically, users are defined by properties. To define users at the system level, you can add them to the "derby.properties" property file. To add users that are to be local to a specific database, you will need to use the SQL stored procedure for defining database level properties.


I want to create a database in the server.

To create a database, you connect to it with the extra attribute "create=true" in the connection URL. If the given database does not exist, it will be created. The "Working With Derby" manual shows how to do this with the interactive ij tool in the section "Creating the database and running SQL". You can also write a Java program to create the database by connecting to it using a similar URL. You can read more about the connection URL and its attributes in "java.sql.DriverManager.getConnection" in the "Reference Manual".

Note that where the database files are created is relative to the derby.system.home property (the default is the current directory) unless you include an absolute path as part of the database name.


I figured there would be command line tools that would allow me to do all
of that, but the tools that exist are very primitive and I can't figure
out how to do anything but start (and stop) the server.

Yes, Derby has only a few and pretty primitive tools. As you see, you need to use a combination of toos, properties, SQL, and JDBC to achieve what you want.


Once I get the above done, my program can take over and create and
populate the tables, but I need a simple way to do the above.

Where should I be looking?

Thanks for any help!

I hope the above helps,

--
Øystein Grøvlen

Reply via email to