I have a java application which retrievs data from a H2 database.
The database and the application are installed on the same computer.
Now when i run the application under my Windows 10 pc everything works fine, but when i copy the java application onto my Raspberry Pi 2 B(Raspbian Jessie) it does not work anymore.
On both systems, I installed, the H2 database, which I can access via the browser interface, and also java.
The error on the Raspberry Pi is:
Feb 26, 2016 2:39:26 AM HelperPackage.DatabaseConnection startConnection
org.h2.jdbc.JdbcSQLException: Table "PRODUKTE" not found; SQL statement:
SELECT Name, Datum, Anzahl, Warnzeitpunkt, ID
ORDER BY Datum;
The expansion of the tilde (~) is not exactly standard.
Funny… I was concerned about this when I first saw that example in the H2 doc. I vaguely recall experiencing other situations where the tilde failed as a symbol for “my home directory/folder”, unrelated to H2 or JDBC.
For my own work, out of my vague paranoia, I have been using this soft-coded call instead of the tilde in my H2 JDBC URL:
System.getProperty( "user.home" )
Something like this.
String jdbcUrl = "jdbc:h2:" + System.getProperty( "user.home" ) + "/test" , "scott" , "tiger" );
This problem reminded me of a similar problem when I have seen situations where
localhost failed to resolve because of some interplay between underlying libraries, forcing the explicit use of
If you ever had time it might be interesting to dig through the H2 source to discover where exactly the tilde expansion failed on the Pi. Something about the Pi’s Java implementation? Or a library in the Pi’s Linux being called by Java?