Q:

How to store the data within java application?

I am using H2 database which is embedded in my java application. I'm creating the connection to the server as:
jdbc:h2:file:/mydata

Where mydata is the database name. This seemed to tell the database connection caller to find the database within the same directory as of the application running from. But it cant find it on client computers. Why? What to do? Where to save the database so as to I don't lose data when I distribute my application?

A:

According to documentation you do not need / before mydata you you need to look up for a file in the same directory

The database URL for connecting to a local database is jdbc:h2:[file:][path]. The prefix file: is optional. If no or only a relative path is used, then the current working directory is used as a starting point. The case sensitivity of the path and database name depend on the operating system, however it is recommended to use lowercase letters only. The database name must be at least three characters long (a limitation of File.createTempFile).

http://www.h2database.com/html/features.html#embedded_databases
So in your example you are trying to connect to file named mydata in the root folder. Looks like you forgot a dot (.) before /mydata. Try with the following jdbc:h2:file:./mydata 

