Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

MSSQL Database backup with Java

Posted on 2003-11-28
12
Medium Priority
?
831 Views
Last Modified: 2010-04-01
Hi,
 
 I have got an option in my web site to take backup of a MSSQL database. How could I do that?
 My idea is : I need to execute some .bat file from java with database name as parameter and the bat file should login into MSSQL server and create backup and copy into specified folder.

 Is there any other way yo do this by using only JAVA?

 Please help me..

thanks a lot..
eve of Chris!
lam
0
Comment
Question by:lamdor
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 9841503
if you don't mind to start to close your old questions:
http://www.experts-exchange.com/Web/Web_Languages/JSP/QH_1072861.html
0
 
LVL 92

Expert Comment

by:objects
ID: 9841546
Using Runtime.exec() to run your batch sounds like the best solution.
0
 
LVL 1

Author Comment

by:lamdor
ID: 9854465
Hi kennethxu,
 

  I have not yet got expected answer from any experts thats why I have not closed..

 thanks,

regards
lam.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Expert Comment

by:davidnaude
ID: 9859996
Just to avoid confusion here, your looking for help on creating the bat file right?
0
 

Expert Comment

by:davidnaude
ID: 9860164
Why not just run the command "backup database <DBName>", try this in query analyser. You will have to have setup your database backup devices already.

Have a look at the following SQL Script

backup database EBO_Bourne_Leisure
      TO DISK = 'c:\DB1.BAK'
      WITH FORMAT,
      NAME = 'My DB Backup'

I have not tried this(quite sure it will work though), but if your not happy with running this directly in your Java App then you can always create a bat file and execute the isql command. To find out more about isql, go into the command propmt and type "isql -?"
0
 
LVL 1

Author Comment

by:lamdor
ID: 9955290
Hi,

 the problem is I am not using windows operating system for hosting the application. I am using Linux as webserver OS. In that I need to use pure java solution for the problem..can anybody tell me how can I?

thanks.
lsm
0
 
LVL 1

Author Comment

by:lamdor
ID: 10144181
Hi all,

 Here I am not asking to create a bat file which does database backup operation. I am looking for a Pure Java solution where I can connect to DB and issue commands (SQL) from Java application to create backup for the database. Is there any way to achive the same..

 Thanks a lot for all experts..

with lluv
dev.
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 400 total points
ID: 10146561
>> I am looking for a Pure Java solution where I can connect to DB and issue commands (SQL) from Java application to create backup for the database.

Then, the answer to your question is NO, you cannot.
Unless the database vendor provided you with such an interface or they are willing to share you with the detail of their native protocol and you are prepared to implement the protocol in java yourself.
0
 
LVL 1

Author Comment

by:lamdor
ID: 10223646
Hi,


 I think this can be achieved with JNI. the databases provide us C Interface from which we can take backups/restores. In that came my program has to call C program..I think..I am under testing this...I will reply soon again..

Thanks for comments kennethxu,davidnaude, objects..

0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10237996
>> C Interface from which we can take backups/restores.
I know there is C interface for DML, but interms of backup/restore. I would be interested to learn if it is documented in anywhere by M$.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question