Hi Igal, thanks.
Looks like you I am new h2 database...I tried to do as you said but
does not work.
I tried this.
public static void main(String[] args){     String sql = "BACKUP TO /
MyApp/backup/myapp.zip"     Statement stm =
MyConnection.getConnection();     stm.executeUpdate(sql);}
Error:Nov 27, 2011 7:07:45 AM bd.Conexao mainGrave:
nullorg.h2.jdbc.JdbcSQLException: Syntax error in SQL statement
"BACKUP TO/[*]MYAPP/BACKUP/MYAPP.ZIP"; expected "NOT, EXISTS, SELECT,
FROM"; SQL statement:BACKUP TO /MYAPP/backup/MYAPP.zip [42001-161]
thanks

On 27 nov, 01:16, Igal <[email protected]> wrote:
> I'm (very) new to H2 so don't take any advice from me at face value, but it
> seems to me that you can simply connect to the database and execute a
> BACKUP SQL statement, pseudo-code like:
>
> public boolean backupDatabase( String path ) {
>
>   boolean isSuccessful = false;
>
>   Connection conn = getConnection();
>   Statement stmt = conn.createStatement();
>
>   String sql = "BACKUP TO " + path;
>
>   stmt.executeUpdate( sql );
>
>   // update isSuccessful (or maybe execute the statement in try/catch)
>
>   return isSuccessful;
>
> }
>
> again -- it's just a thought -- I'm far from the point of writing/testing
> this out.  hope it helps.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to