Solved

MSSQL Database backup with Java

Posted on 2003-11-28
12
795 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
12 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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 100 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java beans and EJBs 5 196
build fail in maven project 11 190
oracle fusion vs MQ 2 122
maven project jars 7 55
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

856 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