简体   繁体   中英

How to write to an embedded derby database of a java desktop application installed in 'C:\Program Files' in Windows environment?

I have a java desktop application which is installed in C:\\Program Files via Windows installer file made by Inno Setup . This program includes an embedded derby database. Ideally program should be able to write to to the derby database. But because of restrictions creating/editing and saving files to C drive in Windows 7, I cannot do the above. If the program is installed in a driver other than C drive, it works. Since I would prefer to give the user 'C:\\Program Files' as default location for application installation, I would like to know if there is a way to overcome this problem.

Appreciate any help that can be given in the direction of solving the problem.

You can specify an alternate location for your Derby database in the connection URL; you can also specify an alternate location by controlling the derby.system.home property. Then your application can be installed in C:\\Program Files but the data can be created elsewhere, for example in the Documents or Application Data folders. Here's some doc on derby.system.home: http://db.apache.org/derby/docs/10.9/ref/rrefproper32066.html

My suggestion is provide a space to enter preferred installation location for users, by default it can be C:\\Program Files\\, but user doesn't have admin access or access to C:\\Program Files, allow users to change this value. But don't force users to install on specific location. You can also give instructions to users like "You need to have admin privileges to install program on this location" something like that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM