Skip to Content

In-Memory Databases in Composition Environment

Some times in java programming, It is a big pain deal with Collections and Arrays, it’s not so easy getting the flexibility presented in our sql engine.
Using hsqldb open source database engine you can manage your in-memory data the same way that your persistent databases.
I prepared a small example to show this funcionality.

Create a java project.

Add hsqldb.jar in your java build path.

Try this example.

See, you can select from your in-memory table using like condition:

  customers.insert(1, “Alvaro Tejada”,”Perú”);
  customers.insert(2, “Craig Cmehil”,”Germany”);
  customers.insert(3, “Jim Spath”,”US”);
  customers.insert(4, “Mark Yolton”,”US”);
  customers.insert(5, “Mark Finnern”,”US”);
  ResultSet rs =“WHERE name like ‘%Mark%’“);  
  while ( {
   System.out.println(rs.getString(“id”) + “-” + rs.getString(“name”) + “-” + rs.getString(“address”));   

Console output:
4-Mark Yolton-US
5-Mark Finnern-US


Your comments are welcome,
Thanks and Regards,

1 Comment
You must be Logged on to comment or reply to a post.
  • Is this type of methodology available also for complex objects like locations, where coordinates are used to infer distances on road, rail and plane networks?