how to create backups h2-database in my internal application ?? I am
looking for but still not found...how to do this using Swing app ?
I see this http://www.h2database.com/h2.pdf:
Backup
java org.h2.tools.Script -url jdbc:h2:~/test -user sa -script test.zip
-options compression zi
Restore
java org.h2.tools.RunScript -url jdbc:h2:~/test -user sa -script
test.zip -options compression zip
but I dont know how to implement this in my swing app...
thanks.
My guess:
String[] args =
{
"-url",
"jdbc:h2:~/test",
"-user",
"sa",
"-script",
"test.zip"
};
org.h2.tools.Script.main(args);
Gili
I am trying this
String[] bkp = {"-url", "jdbc:h2:tcp://localhost:9001/db/mydb", "-
user", "sa", "-password","123", "-script", "/MyApp/backup/myapp.zip"};
org.h2.tools.Script.main(bkp);
Generate the file.zip but when I am trying extract using WinRar or
other return one error and not unzip the file. The error is file is
corrupted.
Any idea ???
thanks.
On 26 nov, 19:25, cowwoc <cow...@bbs.darktech.org> wrote:
> On 26/11/2011 4:09 PM, the nigga wrote:
>
>
>
>
>
>
>
>
>
> > Hello
>
> > how to create backups h2-database in my internal application ?? I am
> > looking for but still not found...how to do this using Swing app ?
>
> > I see thishttp://www.h2database.com/h2.pdf:
Backup
tool (org.h2.tools.Backup
) can not be used to create a online backup; the database must not be in use while running this program."BACKUP TO 'backup.zip'
Afffsss....Not supported online backup??, so how to I will make backup
to my system ???
I am starting h2 database inside my app.
[code]
//begin h2 server
public static void main(String[] args{
Server s = Server.createTcpServer(new String[]{"-tcp","-
tcpAllowOthers","-tcpPort","9001","-trace"});
s.start();//starting h2 server
//backup
String[] bkp = {"-url",
"jdbc:h2:tcp://localhost:9001/db/mydb",
"-user",
"sa",
"-password",
"123",
"-script",
"/MyApp/backup/myapp.zip"};
org.h2.tools.Script.main(bkp);//backup
}
[/code]
What is this: "except if the file systems support creating
snapshots" ????
thanks.
On 26 nov, 23:09, Igal <d...@21solutions.net> wrote:
> according to the docs athttp://www.h2database.com/html/tutorial.html#upgrade_backup_restore:
thanks.
On 27 nov, 01:16, Igal <d...@21solutions.net> wrote:
I am trying this
String[] bkp = {"-url", "jdbc:h2:tcp://localhost:9001/db/mydb", "-
user", "sa", "-password","123", "-script", "/MyApp/backup/myapp.zip"};
org.h2.tools.Script.main(bkp);
Generate the file.zip but when I am trying extract using WinRar or
other return one error and not unzip the file. The error is file is
corrupted.
Any idea ???
There is a Restore tool.
BACKUP TO 'myapp.zip'
100% work
thanks Igal.
On 27 nov, 01:16, Igal <d...@21solutions.net> wrote: