One of the things I notice when reading the Java/NetBeans documentation on database "applications" is that they all envisage an "application" which just scrolls through a recordset displaying records. This so dull. Why would anyone want to create another "application" like this, when there are so many out there which do exactly that. Why write something from scratch when you can buy a product off the shelf like MS Access which does exactly that, and does it jolly well? Why does everyone just copy everyone else?
I want my app to connect to a database, read stuff from it, and write stuff to it, but without my users even knowing it is there. My users are students doing a math activity. My database is of no interest to them, and they as individuals are of no interest to my database. What is of interest is the way they interact with items stored in the database, and I want to use this interaction to refine parameters associated with the items.
If I select New Desktop Application in NetBeans, it produces a form which ploughs through a table in a database, one record at a time. And it produces a myriad of classes, which presumably mimic all the stuff which happens automatically in an off the shelf product like MS Access. I don't want that. I want a simple connection to a database which enables me to read data, process it with my own code, and then to record stuff derived from the processing.
I hardly need record that when I cut and pasted code from the Establishing a Connection lesson in the JDBC trail of the Java Tutorial did not work. I should like to contrast this trail with the Collections or the Basic I/O trails, which were so well written. Everything in those trails made sense, and the code all worked, not least because it was complete. For example, check out the code on this page. It starts with a Copyright statement, which is fair enough for something well written, then it gives three import lines, a class declaration, and code. And if I copy it into a file on my computer, it compiles and runs.
Compare this with the code on the Establishing a Connection page, and, well, what can I say .. there is no comparison. It is supposed to be a lesson, so it is not unreasonable to expect it to include what needs to be imported to make the code work. This lesson is so badly written it ought to be deleted. I have posted a question about it in the Java Tutorial General Discussion forum. And to add to my frustration, when I searched Google using the search string "jdbc:derby data connection", my question was top of the list. What does this say about the volume of material written on the subject? Alarmingly little it seems.
Fortunately, sixth on the list of the same search was a forum post, which helped me at least to write a class, created with a text editor and run from the command line, which created a database, added a table, added lines to the table, queried the table and displayed the table results. I won't post the code here (it never looks very good in a blog), but I have posted it in this forum thread, which also tells the whole story.
I feel quite tired now - not sure what to do next. I've been working on this for a whole month, but I still don't feel much closer to weaving data connection code into my web applet.