Solved

MSSQL Database backup with Java

Posted on 2003-11-28
12
812 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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 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

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!

Question has a verified solution.

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

There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Let's take a look back at the commercialization of the internet to understand why keeping it open and neutral is in our best interest as a society.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 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