Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jonasdavedomingo
Starting Member
33 Posts |
Posted - 2004-12-06 : 21:16:24
|
Hi i'm using MS SQL Server 2000 and i want to know how to backup the DB using a system.I tried this code: public boolean backupIRMS() { boolean stored = false; String query = "ALTER DATABASE SYSTEM SET RECOVERY {SIMPLE};"; String query2 = "BACKUP LOG { IRMS } TO DISK= 'C:Documents and Settings\user\Desktop\system_backup\systembackuplog.bak'"; String query3 = "BACKUP DATABASE (irms ) TO 'C:\Documents and Settings\user\Desktop\system_backup\systembackup.bak WITH DIFFERENTIAL'"; try { DBConnect db = new DBConnect(); db.openCon(); db.execute(query); db.execute(query2); db.execute(query3); db.closeCon(); stored = true; } catch (Exception ex) { System.out.println("Error on Execution: " + ex); } return stored; }but it doesn't compile because there's something wrong in my query syntax. Can anyone help me check the syntax?or does anyone know how to backup DB? what's the code for that? |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-12-06 : 21:21:33
|
why don't you create an sp for the queries and call that in your application?atleast you'll get error messages in the sp when compiling , check { } and ( ) in your text.--------------------keeping it simple... |
 |
|
|
jonasdavedomingo
Starting Member
33 Posts |
Posted - 2004-12-07 : 04:10:43
|
quote: Originally posted by jen why don't you create an sp for the queries and call that in your application?atleast you'll get error messages in the sp when compiling , check { } and ( ) in your text.--------------------keeping it simple...
what's is SP?im using jsp and i call java having that query, the error says illegal function. I dont what to do with the code? |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2004-12-07 : 05:24:36
|
| Test the queries you are rying to run in query analyser.Have alook athttp://www.nigelrivett.net/TransactionLogFileGrows_1.htmlfor how to change the recovery model.Also read through it and you will see that you cannot back up a tr log when the recovery model is simple.An SP is a stored procedure. If you place all your code in stored procedures then you will find development and maintenance a lot easier and a more flexible and secure system.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|