apache - Restoring Derby-Database via Java -


i'm trying restore apache derby database via java. while researching found following page http://db.apache.org/derby/docs/10.3/adminguide/tadminhubbkup44.html . far understand got have running connection server , use given url make restore happen.

i'm not sure how restart , restore running server in java using url.

i have managed restore derby database using backup files created. problem needed shut down database before trying restore it.

but ran problem. after shutdown , following restore of database database doesn't boot automatically. have tried register new driver or set shutdown attribute false none of has worked reboot database via java.

this code far:

public boolean restore() throws datasourceexception {     string databasename = "jdbc:derby://localhost:1527/sun-appserv-samples;restorefrom="+ getrestorepath() +"sun-appserv-samples";   string delete = "jdbc:derby://localhost:1527/sun-appserv-samples;shutdown=true";   try {    drivermanager.getconnection(delete);   } catch (sqlexception e) {    connection con;    try {     con = drivermanager.getconnection(databasename);     con.commit();       try {                        class.forname("org.apache.derby.jdbc.embeddeddriver").newinstance();     } catch (classnotfoundexception e1) {     } catch (instantiationexception e1) {     } catch (illegalaccessexception e1) {     }      con = drivermanager.getconnection("jdbc:derby://localhost:1527/sun-appserv-samples;create=true");     con.commit();     return true;    } catch (sqlexception e1) {    }   }   return false;  } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -