Solved

MSSQL Database backup with Java

Posted on 2003-11-28
12
787 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
For months I had no idea how to 'discover' the IP address of the other end of a link (without asking someone who knows), and it drove me batty. Think about it. You can't use Cisco Discovery Protocol (CDP) because it's not implemented on the ASAs.…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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