This practical we'll do a little database reading and writing.
First of all we'll make ourselves a new project - this practical we'll start off outside of Arc, so we won't make a new ESRI project. If you're feeling fancy, you can combine them later.
First of all, go to New > Java Project, use the 1.7 JDK, and give the project a name. Click Finish (you could do the next step by pushing Next but it is more useful to see how to do it from a menu).
Next, right-click on the project directory, which should have appeared on the Package Explorer window on the
left of the screen. Click New > Class. Give the class the name
DBConnect, no package,
and the following options: main method (on); superclass constructors (on); abstract methods (off). Hit Finish.
This will generate the class. Add:
to the main method so it calls the constructor, and add in the standard constructor if it isn't there.
We'll now make sure our classpath includes the Derby jar files.
Right-click on the project directory again in the Package Explorer window, and select Build Path > Add External Archive.... Navigate to C:\Program Files\Java\jdk1.7.0_55\db\lib and select the derby.jar file. Hit Open. You should see that this adds a new branch to the project directory Referenced Libraries, and under this there should be a whole set of regionalised jar files, and derby.jar.
We should now be able to use the Derby database management system.
Finally in our setup, we'll make a directory to store the database in. Make yourself a directory somewhere easy to get at. For our purposes we'll assume m:\databases\.
When you're done with that, go on to Part Two where we'll start our coding.