Use jsp to back up and restore the SQLServe Database

Source: Internet
Author: User

Backup: Send SQL to mssql (a powerful database platform on WINDOWS) server:
Backup database <your database name> to disk = backup 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 mssql (a powerful database platform on WINDOWS) server is located, and mssql (a powerful database platform on WINDOWS) can be backed up to the network location.

Recovery:
Restore database <your database name> from disk = backup file name with replace
Note that when executing a restore database, the database to be restored must not have any client connection, including itself (the connection to initiate the restore database command ). Use restore to connect to the master database and then send the restore command.
Otherwise, it must fail.

 

How can I use jsp (the preferred choice for SUN Enterprise Applications )?
Sorry, you used this!
<%
Connect to the Connection object first!
You must first establish a connection with the database.
Then you can directly use this statement on the jsp (preferred for SUN Enterprise Applications) page.
Try {
String SQL = "backup database xncsims to disk = d: \ xncback. dat ";

St = con. createStatement ();

Rs1_st.exe cuteQuery (SQL );

}
Catch (SQLException e) {System. out. println (e. toString ());}
Catch (Exception e) {System. out. println (e. toString ());}

%>


Rs1_st.exe cuteQuery (SQL );
Here, your SQL statement is sent to the database for execution.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.