eclipse product access database file causes error -
i building rcp application. have 1 plugin project , i'm trying export product. use sqlite database file . while testying both application , product run of eclipse having no problem @ all, when export product , database access fails. how open database connection
dbconnection = drivermanager.getconnection("jdbc:sqlite:"+filelocator.resolve(platform.getbundle("bundleid").getentry("dbfile")).getpath());
my dbfile in projects root file, , after export , found in bundleid.jar in plugins folder, , application cannot open path calculated sth like.... "/plugins/bundleid.jar!/dbfile"
the "!" before / in string!!!
is there in order overcome this?
use filelocator.tofileurl() on url returned filelocator.resolve() more normal url.
note: expand jar in temporary cache normal file url can returned. cache not guaranteed persistent if want database changes persist need put database somewhere else.
one possibility copy database workspace .metadata in plugin state data (see platform.getstatelocation(bundle).
Comments
Post a Comment