js|sql| Backup | recovery | data | database
Backup: Send SQL to MSSQLServer:
Backup Database <your database name> to disk= ' backed up file name ' with Init
Note: 1. The backup file name must be an absolute path.
2. The backup file can only be the path on the machine where MSSQLServer resides, and MSSQL supports backup to the network location.
Recovery:
Restore Database <your database name> from disk= ' backup filename ' with replace
Note that when the restore database is executed, the databases to be restored must have no client connections, including itself (the connection that originated the Restore Database command). Using restore, you can connect to the master library and then send the Restore command. Otherwise, it must fail.
How to use in JSP?
--------------------------------------------you use this!
<%
To connect the Connection object first!
is to establish a connection with the database first.
And then in the JSP page directly with my statement on it.
try{
String sql= "BACKUP database xncsims to disk= ' D:\\xncback.dat '";
St=con.createstatement ();
Rs=st.executequery (SQL);
}
catch (SQLException e) {System.out.println (e.tostring ());}
catch (Exception e) {System.out.println (e.tostring ());}
%>
Rs=st.executequery (SQL);
This is where you send your SQL statements to the database for execution.