0

I want to create HSQL embedded database but jdbc:hsqldb:file:"What should I write here to work on other PC". If I copy my project to another pc and click the jar file , it needs to access my database. So, what should I write for file path ? My application works on my PC but does not work on other PC because it does not access the database.

Please help me. Thank you.

Clifford
  • 88,407
  • 13
  • 85
  • 165
Ver
  • 13
  • 3

1 Answers1

0

If you're trying to access a file that isn't located on the same machine, you're most likely out of luck, unless you can set up a link, file sharing, etc.

If you want to make the file location configurable, then use a system parameter, a config file value, etc. and construct the JDBC string from that, e.g.,

java -jar some.jar -Ddb.location=/some/file/path
...
String url = "jdbc:jsqldb:file:" + System.getProperty("db.location");

If you want to access a DB server then you're probably going about this the wrong way.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302