Thursday, September 21, 2017

1019 Part 2 of Java 8 Code for loading h2 database, and editing rows record by record


This is in continuation of previous post NO. 1018 Click to go to 1018 at this blog. As promised, I copy and paste below, the Java 8 code for editing h2 embedded database records, saved by me as file yh2db.java. After saving, this file has been compiled as a Java Class, by using javac command. For those who use installed java 8, the javac compilation command can be invoked from command line reading something like:

javac yh2db.java
(or any other file name, of Readers' Preference, after changing the class name in the file). This javac command is to be invoked from the folder in which the ybh2db.java (or any other name) file is located.
I use linux portable java 8. Hence, I have used a slightly different path for the command line.
....path/javac yh2db.java.

After compilation without errors, the Class can be executed with java command.
java ybh2db (or any other file name of Readers' choice).

Notes about column names used in the tables, and sql statements


For convenience, I have created h2 database tables with simple column names such as c1, c2, c3, c4, c5, c6, c7, c8, c9, c10. The same simple column names c1, c2, c3, c4, c5 have been used in sql statements. Readers can freely change these columns to any other column names of their choice, in the tables they create. This Java 8 code is not useful for creating tables, at this preliminary stage.

Tables for embedded h2 database can be created by using h2 console, discussed in the previous blog post referred to above.

Now, the java 8 code for the Editor


No comments:

Post a Comment

ఘోరమైన విమర్శలకు కూడ స్వాగతం, జవాబులు ఇవ్వబడతాయి. Harsh Criticism is also welcome.