Whoa, did not expect that to be about Idris. So let's talk about Java!
I've had good experiences with the junit-quickcheck library for Java, even though it's necessarily 10x clunkier and 0.1x as powerful as the real Haskell QuickCheck. The core idea is definitely there—test your code by asserting that certain properties must be true no matter what the input is.
I do a lot of data-based programming, so another similar technique I've found is to have the test suite dump results into an embedded HSQLDB database, and have the test cases be SQL statements that return zero rows if the test succeeds. This doesn't intrinsically have the random data generation bits of the QuickCheck approach, but it does do a good job of enabling specification-based testing—your test queries's WHERE clauses are, fundamentally, the negation of the specification's statements.
We also have a lot of QA people and business users who are decent with SQL, and we have been training them to submit appropriate SQL statements with issue reports, which we can then just plop right into our automated test suite with minimal cleanup. With a custom JUnit runner we don't even need to write new code—we just put a file with the SQL query into a designated location and it automatically becomes a test case.
I'd recommend HyperSQL (http://hsqldb.org/). It's an in-process database (like sqlite) so you don't have to install anything. You just use it as you would any other JDBC driver in your application but instead of a connect string with a hostname / port you just use a path to a disk location. The benefit of HyperSQL is that it's pure java so you don't need anything other than a single jar. It also supports more advanced features than sqlite.
So basically there's two things you need to learn: - JDBC (Java DataBase Connectivity): http://www.oracle.com/technetwork/java/index-140429.html - HyperSQL: http://hsqldb.org/web/hsqlDocsFrame.html
HSQLDB is a very nice pure Java embedded database. It's also very easy to use, there's plenty of documentation with some nice examples for beginners.
Some games do use databases. Civ 5 uses sqlite for example. If you're using java something like hsqldb would be the equivalent. But what you want to do depends on what you expect your data to look like and other goals (if you want to learn SQL by all means use a db). If you had lots of entries and a static hierarchy a SQL database may be appropriate, but make sure you commit to learning how to index properly. You can make or break a program with one index. Also SQL is not appropriate for all data structures. They tend to do trees poorly for example, because they are based on relational calculus.
If you have only a few hundred or thousand data points you may be want to use flat files. This is probably the most common, but most have their own formats. I'd use XML or json (json is lighter weight) are good if you want human readable because the tools are there, otherwise pick a binary format. One thing about files, standard HDDs are ok at sequential access, but are terrible at random seeks. So you may want to use only a few files. You'll also have to create algorithms that best suite your data use. This could be as simple as hashmaps or lists. But without knowing exactly what you're doing it's hard to tell.
I'm going to guess that you would do fine either way and it's all about which tools you'd like to learn. If I were doing that I'd create one file or table for each class of objects. I'd probably use json so I could see the files and because it's lighter weight then a database. I don't think performance should be an issue with this sort of application because you're going to run out of monsters after a few hundred.
You could grab an open source roguelike like nethack and look at what they do. I found a list of java roguelikes. Maybe check out a few.
hypersql is a pretty solid pure java embedded sql database. it's hard to say whether it would meet your needs or not, but it has several advantages over a text file, with the main one being the ability to do relational operations on the data (sorting, searching, counting, joining etc), without writing it all yourself.
iText is the most popular pdf/print layout java library, though I've never used it.
Applications like LibreOffice and Mathmatica use HSQLDB instead of SQLite because the typelessness of SQLite is a detriment.
It's midnight on Christmas so I'm not going to type a novel but ecsentially you'll need to use DriverManager.getConnection(url) to create a connection to your DB. As you haven't listed what type of DB or what you're doing I recommend following this guide: http://hsqldb.org/doc/2.0/guide/running-chapt.html#rgc_inprocess.
Good luck, have fun. Merry Christmas.
What you really want to do is to create a query based on your two tables. If you have setup your tables right, this should go smoothly.
There should be some videos on YouTube on how to create queries in base. I believe you can do it with the GUI using their query by example or you can use an SQL statement. If you want to use an SQL statement, there are many resources out there.
Base uses hsqldb, http://hsqldb.org/, in their documentation you can find examples of SQL statements.
After you have the query the way you want it, you can make your report based on that saved query. It will then be dynamic with your tables. If the data in your tables change, so will your report.
Good luck.
The UPDATE
command syntax does not allow a JOIN - HSQLDB follows the SQL standard here.
You need to either use a co-related subquery or the MERGE statement
looks like it's not easy to connect to that DB.. apparently, one should be able to use the hsqldb tools, but it doesn't work here:
sql> \j jdbc:hsqldb:file:/root/subsonic.data
org.hsqldb.cmdline.SqlFile$BadSpecial: Failed to connect
at org.hsqldb.cmdline.SqlFile.processSpecial(Unknown Source)
at org.hsqldb.cmdline.SqlFile.scanpass(Unknown Source)
at org.hsqldb.cmdline.SqlFile.execute(Unknown Source)
at org.hsqldb.cmdline.SqlTool.objectMain(Unknown Source)
at org.hsqldb.cmdline.SqlTool.main(Unknown Source)
Caused by: java.lang.Exception: url not set for 'jdbc:hsqldb:file:/root/subsonic.data' in file '/root/sqltool.rc'
at org.hsqldb.lib.RCData.<init>(Unknown Source)
... 5 more
According to this, Libreoffice does include Hypersonic, and it comes with Android. I would say, this is your best bet to solve your issue.
sounds like flat file as a DB. I know that Jenkins-CI uses XML for all data storage (jobs, configurations, user info, etc etc). Poking at that code might demonstrate how a well oiled machine runs.
One that comes to mind that I've seen in various configs is HSQLDB which is native java (so shoudl be easy to understand how / what it is doing).
Glad you like it :).
I'll update the docs with details on these questions.
> How has no one mentioned SQLite?
For java devs HyperSQL is actually a much better option. No native code (it's pure Java) and last time I used it it also was much more feature-rich (cascading deletes didn't exist in SQLite then) than SQLite.